Source/WebCore: Added adoptCOM to COMPtr on Windows.

https://bugs.webkit.org/show_bug.cgi?id=122069

Patch by Alex Christensen <achristensen@webkit.org> on 2013-10-01
Reviewed by Brent Fulgham.

* platform/win/COMPtr.h:
(adoptCOM): Added.

Source/WebKit/win: Implemented createWebViewWithRequest in WinLauncher.
https://bugs.webkit.org/show_bug.cgi?id=122069

Patch by Alex Christensen <achristensen@webkit.org> on 2013-10-01
Reviewed by Brent Fulgham.

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::createWindow):
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchCreatePage):
Pass request url from the NavigationAction to createWebViewWithRequest.

Tools: Implemented createWebViewWithRequest in WinLauncher.
https://bugs.webkit.org/show_bug.cgi?id=122069

Patch by Alex Christensen <achristensen@webkit.org> on 2013-10-01
Reviewed by Brent Fulgham.

* WinLauncher/PrintWebUIDelegate.cpp:
(PrintWebUIDelegate::createWebViewWithRequest): Added.
* WinLauncher/PrintWebUIDelegate.h:
Removed createWebViewWithRequest stub.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d1aecf01
2013-10-01 Alex Christensen <achristensen@webkit.org>
Added adoptCOM to COMPtr on Windows.
https://bugs.webkit.org/show_bug.cgi?id=122069
Reviewed by Brent Fulgham.
* platform/win/COMPtr.h:
(adoptCOM): Added.
2013-10-01 Jer Noble <jer.noble@apple.com>
Unreviewed build fix; The addedFunction and removedFunction arguments to determineChangedTracksFromNewTracksAndOldItems
......@@ -101,6 +101,11 @@ private:
T* m_ptr;
};
template<typename T> inline COMPtr<T> adoptCOM(T *ptr)
{
return COMPtr<T>(AdoptCOM, ptr);
}
template<typename T> inline void COMPtr<T>::clear()
{
if (T* ptr = m_ptr) {
......
2013-10-01 Alex Christensen <achristensen@webkit.org>
Implemented createWebViewWithRequest in WinLauncher.
https://bugs.webkit.org/show_bug.cgi?id=122069
Reviewed by Brent Fulgham.
* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::createWindow):
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchCreatePage):
Pass request url from the NavigationAction to createWebViewWithRequest.
2013-09-30 Andreas Kling <akling@apple.com>
Try to fix the Windows build.
......
......@@ -194,14 +194,13 @@ static COMPtr<IPropertyBag> createWindowFeaturesPropertyBag(const WindowFeatures
return COMPtr<IPropertyBag>(AdoptCOM, COMPropertyBag<COMVariant>::adopt(map));
}
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction&)
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction& navigationAction)
{
COMPtr<IWebUIDelegate> delegate = uiDelegate();
if (!delegate)
return 0;
// Just create a blank request because createWindow() is only required to create window but not to load URL.
COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance());
COMPtr<WebMutableURLRequest> request = adoptCOM(WebMutableURLRequest::createInstance(ResourceRequest(navigationAction.url())));
COMPtr<IWebUIDelegatePrivate2> delegatePrivate(Query, delegate);
if (delegatePrivate) {
......
......@@ -529,7 +529,7 @@ void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
}
}
Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction&)
Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction)
{
WebView* webView = m_webFrame->webView();
......@@ -538,7 +538,8 @@ Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction&)
return 0;
COMPtr<IWebView> newWebView;
if (FAILED(ui->createWebViewWithRequest(webView, 0, &newWebView)))
COMPtr<WebMutableURLRequest> request = adoptCOM(WebMutableURLRequest::createInstance(ResourceRequest(navigationAction.url())));
if (FAILED(ui->createWebViewWithRequest(webView, request.get(), &newWebView)) || !newWebView)
return 0;
COMPtr<IWebFrame> mainFrame;
......
2013-10-01 Alex Christensen <achristensen@webkit.org>
Implemented createWebViewWithRequest in WinLauncher.
https://bugs.webkit.org/show_bug.cgi?id=122069
Reviewed by Brent Fulgham.
* WinLauncher/PrintWebUIDelegate.cpp:
(PrintWebUIDelegate::createWebViewWithRequest): Added.
* WinLauncher/PrintWebUIDelegate.h:
Removed createWebViewWithRequest stub.
2013-10-01 Tim Horton <timothy_horton@apple.com>
[wk2] WebKitTestRunner's window snapshots are blank with tiled drawing
......
/*
* Copyright (C) 2009, 2013 Apple Inc. All Rights Reserved.
* Copyright (C) 2009 Brent Fulgham. All Rights Reserved.
* Copyright (C) 2013 Alex Christensen. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -37,6 +38,32 @@
static const int MARGIN = 20;
HRESULT STDMETHODCALLTYPE PrintWebUIDelegate::createWebViewWithRequest(IWebView*, IWebURLRequest* request, IWebView**)
{
if (!request)
return E_POINTER;
TCHAR executablePath[MAX_PATH];
DWORD length = ::GetModuleFileName(GetModuleHandle(0), executablePath, ARRAYSIZE(executablePath));
if (!length)
return E_FAIL;
_bstr_t url;
HRESULT hr = request->URL(&url.GetBSTR());
if (FAILED(hr))
return E_FAIL;
std::wstring command = std::wstring(L"\"") + executablePath + L"\" " + (const wchar_t*)url;
PROCESS_INFORMATION processInformation;
STARTUPINFOW startupInfo;
memset(&startupInfo, 0, sizeof(startupInfo));
if (!::CreateProcessW(0, (LPWSTR)command.c_str(), 0, 0, 0, 0, 0, 0, &startupInfo, &processInformation))
return E_FAIL;
return S_OK;
}
HRESULT PrintWebUIDelegate::QueryInterface(REFIID riid, void** ppvObject)
{
*ppvObject = 0;
......
......@@ -38,7 +38,7 @@ public:
virtual ULONG STDMETHODCALLTYPE AddRef(void);
virtual ULONG STDMETHODCALLTYPE Release(void);
virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView*, IWebURLRequest*, IWebView**) { return E_NOTIMPL; }
virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView*, IWebURLRequest*, IWebView**);
virtual HRESULT STDMETHODCALLTYPE webViewShow(IWebView*) { return E_NOTIMPL; }
virtual HRESULT STDMETHODCALLTYPE webViewClose(IWebView*) { return E_NOTIMPL; }
virtual HRESULT STDMETHODCALLTYPE webViewFocus(IWebView*) { return E_NOTIMPL; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment