WebKit Bugzilla
Attachment 340163 Details for
Bug 185418
: [Win][MiniBrowser] Move WK1 related code into MiniBrowser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185418-20180511123835.patch (text/plain), 10.90 KB, created by
Fujii Hironori
on 2018-05-10 20:38:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2018-05-10 20:38:36 PDT
Size:
10.90 KB
patch
obsolete
>Subversion Revision: 231684 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 9168fec79b4aab1dfcd037d1eee1e8e0d2e0c222..462e95e8968446696bf528f23b64ed0e1fdfda86 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,28 @@ >+2018-05-10 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ [Win][MiniBrowser] Move WK1 related code into MiniBrowser >+ https://bugs.webkit.org/show_bug.cgi?id=185418 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ All WK1 related code should be moved into MiniBrowser for the preparation >+ of Bug 184770. >+ >+ This change moves the initilization code of MiniBrowse into MiniBrowser::init(). >+ >+ * MiniBrowser/win/Common.cpp: >+ (getAppDataFolder): Removed `static` keyword to be called from MiniBrowser.cpp. >+ (setCacheFolder): This is only for WK1. Moved into MiniBrowser.cpp. >+ * MiniBrowser/win/Common.h: Added. >+ * MiniBrowser/win/MiniBrowser.cpp: >+ (MiniBrowser::init): Moved the initilization code from wWinMain. >+ (MiniBrowser::setCacheFolder): Moved from Common.cpp and made it a method. >+ * MiniBrowser/win/MiniBrowser.h: >+ (MiniBrowser::setCacheFolder): Changed to a private method. >+ (MiniBrowser::subclassForLayeredWindow): Changed to a private method. >+ * MiniBrowser/win/WinMain.cpp: >+ (wWinMain): Moved MiniBrowse initilization code into MiniBrowser.cpp. >+ > 2018-05-10 Jonathan Bedard <jbedard@apple.com> > > REGRESSION (r230998): Cannot stream API test output >diff --git a/Tools/MiniBrowser/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp >index 4bc41b96bb00a0635ab8f73c6a18ec340d2b59f5..67f238390e86025489ea709ccfa0b2c3cf30f82e 100644 >--- a/Tools/MiniBrowser/win/Common.cpp >+++ b/Tools/MiniBrowser/win/Common.cpp >@@ -26,11 +26,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include "AccessibilityDelegate.h" > #include "DOMDefaultImpl.h" >-#include "PrintWebUIDelegate.h" >-#include "ResourceLoadDelegate.h" >-#include "WebDownloadDelegate.h" > #include "MiniBrowser.h" > #include "MiniBrowserReplace.h" > #include <WebKitLegacy/WebKitCOMAPI.h> >@@ -154,7 +150,7 @@ BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID) > return TRUE; > } > >-static bool getAppDataFolder(_bstr_t& directory) >+bool getAppDataFolder(_bstr_t& directory) > { > wchar_t appDataDirectory[MAX_PATH]; > if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory))) >@@ -171,22 +167,6 @@ static bool getAppDataFolder(_bstr_t& directory) > return true; > } > >-static bool setCacheFolder() >-{ >- IWebCachePtr webCache = gMiniBrowser->webCache(); >- if (!webCache) >- return false; >- >- _bstr_t appDataFolder; >- if (!getAppDataFolder(appDataFolder)) >- return false; >- >- appDataFolder += L"\\cache"; >- webCache->setCacheFolder(appDataFolder); >- >- return true; >-} >- > void createCrashReport(EXCEPTION_POINTERS* exceptionPointers) > { > _bstr_t directory; >diff --git a/Tools/MiniBrowser/win/Common.h b/Tools/MiniBrowser/win/Common.h >new file mode 100644 >index 0000000000000000000000000000000000000000..61a935721290424c81cdeb59eef2f8f3db889519 >--- /dev/null >+++ b/Tools/MiniBrowser/win/Common.h >@@ -0,0 +1,31 @@ >+/* >+ * Copyright (C) 2018 Sony Interactive Entertainment Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+bool getAppDataFolder(_bstr_t& directory); >+ >+extern POINT s_windowPosition; >+extern SIZE s_windowSize; >diff --git a/Tools/MiniBrowser/win/MiniBrowser.cpp b/Tools/MiniBrowser/win/MiniBrowser.cpp >index 35df2d8bb33399a0943dec5423ebf9dfc62550ca..749bf044a5ac7541938261e5e9d5700a9725db06 100644 >--- a/Tools/MiniBrowser/win/MiniBrowser.cpp >+++ b/Tools/MiniBrowser/win/MiniBrowser.cpp >@@ -29,9 +29,15 @@ > #include "stdafx.h" > #include "MiniBrowser.h" > >+#include "AccessibilityDelegate.h" >+#include "Common.h" > #include "DOMDefaultImpl.h" > #include "MiniBrowserLibResource.h" > #include "MiniBrowserReplace.h" >+#include "MiniBrowserWebHost.h" >+#include "PrintWebUIDelegate.h" >+#include "ResourceLoadDelegate.h" >+#include "WebDownloadDelegate.h" > #include <WebKitLegacy/WebKitCOMAPI.h> > #include <wtf/ExportMacros.h> > #include <wtf/Platform.h> >@@ -63,7 +69,7 @@ MiniBrowser::MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, b > { > } > >-HRESULT MiniBrowser::init() >+HRESULT MiniBrowser::init(_bstr_t& requestedURL) > { > updateDeviceScaleFactor(); > >@@ -84,10 +90,73 @@ HRESULT MiniBrowser::init() > return hr; > > hr = WebKitCreateInstance(CLSID_WebCache, 0, __uuidof(m_webCache), reinterpret_cast<void**>(&m_webCache.GetInterfacePtr())); >+ if (FAILED(hr)) >+ return hr; >+ >+ if (!seedInitialDefaultPreferences()) >+ return E_FAIL; >+ >+ if (!setToDefaultPreferences()) >+ return E_FAIL; >+ >+ if (!setCacheFolder()) >+ return E_FAIL; >+ >+ auto webHost = new MiniBrowserWebHost(this, m_hURLBarWnd); >+ >+ hr = setFrameLoadDelegate(webHost); >+ if (FAILED(hr)) >+ return hr; >+ >+ hr = setFrameLoadDelegatePrivate(webHost); >+ if (FAILED(hr)) >+ return hr; >+ >+ hr = setUIDelegate(new PrintWebUIDelegate()); >+ if (FAILED (hr)) >+ return hr; >+ >+ hr = setAccessibilityDelegate(new AccessibilityDelegate()); >+ if (FAILED (hr)) >+ return hr; >+ >+ hr = setResourceLoadDelegate(new ResourceLoadDelegate(this)); >+ if (FAILED(hr)) >+ return hr; >+ >+ IWebDownloadDelegatePtr downloadDelegate; >+ downloadDelegate.Attach(new WebDownloadDelegate()); >+ hr = setDownloadDelegate(downloadDelegate); >+ if (FAILED(hr)) >+ return hr; >+ >+ RECT clientRect; >+ ::GetClientRect(m_hMainWnd, &clientRect); >+ if (usesLayeredWebView()) >+ clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy }; >+ >+ hr = prepareViews(m_hMainWnd, clientRect, requestedURL.GetBSTR()); >+ if (FAILED(hr)) >+ return hr; >+ >+ if (usesLayeredWebView()) >+ subclassForLayeredWindow(); > > return hr; > } > >+bool MiniBrowser::setCacheFolder() >+{ >+ _bstr_t appDataFolder; >+ if (!getAppDataFolder(appDataFolder)) >+ return false; >+ >+ appDataFolder += L"\\cache"; >+ webCache()->setCacheFolder(appDataFolder); >+ >+ return true; >+} >+ > HRESULT MiniBrowser::prepareViews(HWND mainWnd, const RECT& clientRect, const BSTR& requestedURL) > { > if (!m_webView) >diff --git a/Tools/MiniBrowser/win/MiniBrowser.h b/Tools/MiniBrowser/win/MiniBrowser.h >index 450c866c92eb63c337681a644e2cf4ae4405ada3..4eb58c2b41dd2ef8c1f51774ae5eb886455e78c6 100644 >--- a/Tools/MiniBrowser/win/MiniBrowser.h >+++ b/Tools/MiniBrowser/win/MiniBrowser.h >@@ -49,7 +49,7 @@ class MiniBrowser { > public: > MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); > >- HRESULT init(); >+ HRESULT init(_bstr_t& requestedURL); > HRESULT prepareViews(HWND mainWnd, const RECT& clientRect, const BSTR& requestedURL); > > HRESULT loadURL(const BSTR& passedURL); >@@ -98,10 +98,11 @@ public: > > HGDIOBJ urlBarFont() { return m_hURLBarFont; } > HWND hwnd() { return m_viewWnd; } >- void subclassForLayeredWindow(); > > private: >+ void subclassForLayeredWindow(); > void generateFontForScaleFactor(float); >+ bool setCacheFolder(); > > std::vector<IWebHistoryItemPtr> m_historyItems; > >diff --git a/Tools/MiniBrowser/win/WinMain.cpp b/Tools/MiniBrowser/win/WinMain.cpp >index 8b83a1777cf5ca6ef3584f3c6015f65976cc84da..0c9b9a25268d08815e20dd7cd70d57154e8eb7b1 100644 >--- a/Tools/MiniBrowser/win/WinMain.cpp >+++ b/Tools/MiniBrowser/win/WinMain.cpp >@@ -30,7 +30,6 @@ > > #include "stdafx.h" > #include "MiniBrowserLibResource.h" >-#include "MiniBrowserWebHost.h" > #include "Common.cpp" > > namespace WebCore { >@@ -103,68 +102,15 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, > > SetFocus(hURLBarWnd); > >- RECT clientRect; >- ::GetClientRect(hMainWnd, &clientRect); >- >- if (usesLayeredWebView) >- clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy }; >- >- MiniBrowserWebHost* webHost = nullptr; >- >- IWebDownloadDelegatePtr downloadDelegate; >- downloadDelegate.Attach(new WebDownloadDelegate()); >- > gMiniBrowser = new MiniBrowser(hMainWnd, hURLBarWnd, usesLayeredWebView, pageLoadTesting); > if (!gMiniBrowser) > goto exit; >- >- if (!gMiniBrowser->seedInitialDefaultPreferences()) >- goto exit; >- >- if (!gMiniBrowser->setToDefaultPreferences()) >- goto exit; >- >- HRESULT hr = gMiniBrowser->init(); >- if (FAILED(hr)) >- goto exit; >- >- if (!setCacheFolder()) >- goto exit; >- >- webHost = new MiniBrowserWebHost(gMiniBrowser, hURLBarWnd); >- >- hr = gMiniBrowser->setFrameLoadDelegate(webHost); >+ HRESULT hr = gMiniBrowser->init(requestedURL); > if (FAILED(hr)) > goto exit; > >- hr = gMiniBrowser->setFrameLoadDelegatePrivate(webHost); >- if (FAILED(hr)) >- goto exit; >- >- hr = gMiniBrowser->setUIDelegate(new PrintWebUIDelegate()); >- if (FAILED (hr)) >- goto exit; >- >- hr = gMiniBrowser->setAccessibilityDelegate(new AccessibilityDelegate()); >- if (FAILED (hr)) >- goto exit; >- >- hr = gMiniBrowser->setResourceLoadDelegate(new ResourceLoadDelegate(gMiniBrowser)); >- if (FAILED(hr)) >- goto exit; >- >- hr = gMiniBrowser->setDownloadDelegate(downloadDelegate); >- if (FAILED(hr)) >- goto exit; >- >- hr = gMiniBrowser->prepareViews(hMainWnd, clientRect, requestedURL.GetBSTR()); >- if (FAILED(hr)) >- goto exit; > gViewWindow = gMiniBrowser->hwnd(); > >- if (gMiniBrowser->usesLayeredWebView()) >- gMiniBrowser->subclassForLayeredWindow(); >- > resizeSubViews(); > > ShowWindow(gViewWindow, nCmdShow);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185418
: 340163