WebKit Bugzilla
Attachment 342241 Details for
Bug 186421
: [Win][MiniBrowser] Add a new BrowserWindow interface to abstract WK1 and WK2 BrowserWindow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186421-20180608140533.patch (text/plain), 10.93 KB, created by
Fujii Hironori
on 2018-06-07 22:05:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2018-06-07 22:05:34 PDT
Size:
10.93 KB
patch
obsolete
>Subversion Revision: 232615 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 9f29e82dcb51487eb9b11212171363de8fee13b0..185b40aa8933f3dc86323f4884a1fce93dc4cccd 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,30 @@ >+2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ [Win][MiniBrowser] Add a new BrowserWindow interface to abstract WK1 and WK2 BrowserWindow >+ https://bugs.webkit.org/show_bug.cgi?id=186421 >+ >+ Reviewed by Ryosuke Niwa. >+ >+ This is the core patch to make MiniBrowser to support WK1 and WK2 >+ windows (Bug 184770). >+ >+ I will rename MiniBrowser class to WK1BrowserWindow in a follow-up >+ patch (Bug 184770 Comment 12). >+ >+ * MiniBrowser/win/BrowserWindow.h: Added. >+ * MiniBrowser/win/MainWindow.cpp: >+ (MainWindow::WndProc): >+ * MiniBrowser/win/MainWindow.h: >+ (MainWindow::browserWindow const): >+ * MiniBrowser/win/MiniBrowser.cpp: >+ (MiniBrowser::create): >+ (MiniBrowser::navigateForwardOrBackward): Removed the unsed first argument hWnd. >+ (MiniBrowser::navigateToHistory): Ditto. >+ * MiniBrowser/win/MiniBrowser.h: Inherit BrowserWindow interface. >+ Make all other methods private and make delegates classes friends. >+ * MiniBrowser/win/PrintWebUIDelegate.cpp: >+ (PrintWebUIDelegate::createWebViewWithRequest): >+ > 2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win][MiniBrowser] MiniBrowser::updateDeviceScaleFactor should be a MainWindow's method >diff --git a/Tools/MiniBrowser/win/BrowserWindow.h b/Tools/MiniBrowser/win/BrowserWindow.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9aeaec4d09fe3a1bd94f72e4ae8c4a8a8665fc27 >--- /dev/null >+++ b/Tools/MiniBrowser/win/BrowserWindow.h >@@ -0,0 +1,58 @@ >+/* >+ * 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 >+ >+#include <windows.h> >+#include <wtf/RefCounted.h> >+ >+class BrowserWindow : public RefCounted<BrowserWindow> { >+public: >+ virtual ~BrowserWindow() { }; >+ >+ virtual HRESULT init() = 0; >+ virtual HWND hwnd() = 0; >+ >+ virtual HRESULT loadHTMLString(const BSTR&) = 0; >+ virtual HRESULT loadURL(const BSTR& passedURL) = 0; >+ virtual void navigateForwardOrBackward(UINT menuID) = 0; >+ virtual void navigateToHistory(UINT menuID) = 0; >+ virtual void setPreference(UINT menuID, bool enable) = 0; >+ virtual bool usesLayeredWebView() const { return false; } >+ >+ virtual void print() = 0; >+ virtual void launchInspector() = 0; >+ >+ virtual _bstr_t userAgent() = 0; >+ virtual void setUserAgent(UINT menuID) = 0; >+ virtual void setUserAgent(_bstr_t& customUAString) = 0; >+ >+ virtual void showLayerTree() = 0; >+ virtual void updateStatistics(HWND dialog) = 0; >+ >+ virtual void resetZoom() = 0; >+ virtual void zoomIn() = 0; >+ virtual void zoomOut() = 0; >+}; >diff --git a/Tools/MiniBrowser/win/MainWindow.cpp b/Tools/MiniBrowser/win/MainWindow.cpp >index b9aac7fbcb6956320e109e2015eca9afae84aa16..5ed23cf86df3698dad527bfec7f1af1fddc8d423 100644 >--- a/Tools/MiniBrowser/win/MainWindow.cpp >+++ b/Tools/MiniBrowser/win/MainWindow.cpp >@@ -163,7 +163,7 @@ LRESULT CALLBACK MainWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPA > return DefWindowProc(hWnd, message, wParam, lParam); > } > if (wmId >= IDM_HISTORY_LINK0 && wmId <= IDM_HISTORY_LINK9) { >- thisWindow->browserWindow()->navigateToHistory(hWnd, wmId); >+ thisWindow->browserWindow()->navigateToHistory(wmId); > break; > } > // Parse the menu selections: >@@ -191,7 +191,7 @@ LRESULT CALLBACK MainWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPA > break; > case IDM_HISTORY_BACKWARD: > case IDM_HISTORY_FORWARD: >- thisWindow->browserWindow()->navigateForwardOrBackward(hWnd, wmId); >+ thisWindow->browserWindow()->navigateForwardOrBackward(wmId); > break; > case IDM_UA_OTHER: > DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_AGENT), hWnd, customUserAgentDialogProc, reinterpret_cast<LPARAM>(thisWindow.get())); >diff --git a/Tools/MiniBrowser/win/MainWindow.h b/Tools/MiniBrowser/win/MainWindow.h >index 2de4b47756c58395dc703298da263ba7edf86064..4404d1cddee753819ae913e17238caada9a6a903 100644 >--- a/Tools/MiniBrowser/win/MainWindow.h >+++ b/Tools/MiniBrowser/win/MainWindow.h >@@ -39,7 +39,7 @@ public: > > void resizeSubViews(); > HWND hwnd() const { return m_hMainWnd; } >- MiniBrowser* browserWindow() const { return m_browserWindow.get(); } >+ BrowserWindow* browserWindow() const { return m_browserWindow.get(); } > > void loadURL(BSTR url); > >@@ -62,5 +62,5 @@ private: > HWND m_hForwardButtonWnd { nullptr }; > HWND m_hCacheWnd { nullptr }; > HGDIOBJ m_hURLBarFont { nullptr }; >- RefPtr<MiniBrowser> m_browserWindow; >+ RefPtr<BrowserWindow> m_browserWindow; > }; >diff --git a/Tools/MiniBrowser/win/MiniBrowser.cpp b/Tools/MiniBrowser/win/MiniBrowser.cpp >index 602ad6fd032cb4250ce5df9357885ad523937752..e9672977e0a6b9574569e928d2c07186c6150127 100644 >--- a/Tools/MiniBrowser/win/MiniBrowser.cpp >+++ b/Tools/MiniBrowser/win/MiniBrowser.cpp >@@ -60,7 +60,7 @@ static const int maxHistorySize = 10; > > typedef _com_ptr_t<_com_IIID<IWebMutableURLRequest, &__uuidof(IWebMutableURLRequest)>> IWebMutableURLRequestPtr; > >-Ref<MiniBrowser> MiniBrowser::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting) >+Ref<BrowserWindow> MiniBrowser::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting) > { > return adoptRef(*new MiniBrowser(mainWnd, urlBarWnd, useLayeredWebView, pageLoadTesting)); > } >@@ -430,7 +430,7 @@ void MiniBrowser::launchInspector() > m_inspector->show(); > } > >-void MiniBrowser::navigateForwardOrBackward(HWND hWnd, UINT menuID) >+void MiniBrowser::navigateForwardOrBackward(UINT menuID) > { > if (!m_webView) > return; >@@ -442,7 +442,7 @@ void MiniBrowser::navigateForwardOrBackward(HWND hWnd, UINT menuID) > m_webView->goBack(&wentBackOrForward); > } > >-void MiniBrowser::navigateToHistory(HWND hWnd, UINT menuID) >+void MiniBrowser::navigateToHistory(UINT menuID) > { > if (!m_webView) > return; >diff --git a/Tools/MiniBrowser/win/MiniBrowser.h b/Tools/MiniBrowser/win/MiniBrowser.h >index ec5428c5abffadb361156698780fdc5789f1585c..3633b28a2219989a1310c66bbb7d9ea7d2c20101 100644 >--- a/Tools/MiniBrowser/win/MiniBrowser.h >+++ b/Tools/MiniBrowser/win/MiniBrowser.h >@@ -24,12 +24,12 @@ > */ > > #pragma once >+#include "BrowserWindow.h" > #include "PageLoadTestClient.h" > #include <WebKitLegacy/WebKit.h> > #include <comip.h> > #include <memory> > #include <vector> >-#include <wtf/RefCounted.h> > > typedef _com_ptr_t<_com_IIID<IWebFrame, &__uuidof(IWebFrame)>> IWebFramePtr; > typedef _com_ptr_t<_com_IIID<IWebView, &__uuidof(IWebView)>> IWebViewPtr; >@@ -48,9 +48,17 @@ typedef _com_ptr_t<_com_IIID<IWebResourceLoadDelegate, &__uuidof(IWebResourceLoa > typedef _com_ptr_t<_com_IIID<IWebDownloadDelegate, &__uuidof(IWebDownloadDelegate)>> IWebDownloadDelegatePtr; > typedef _com_ptr_t<_com_IIID<IWebFramePrivate, &__uuidof(IWebFramePrivate)>> IWebFramePrivatePtr; > >-class MiniBrowser : public RefCounted<MiniBrowser> { >+class MiniBrowser : public BrowserWindow { > public: >- static Ref<MiniBrowser> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); >+ static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); >+ >+private: >+ friend class AccessibilityDelegate; >+ friend class MiniBrowserWebHost; >+ friend class PrintWebUIDelegate; >+ friend class WebDownloadDelegate; >+ friend class ResourceLoadDelegate; >+ friend class PageLoadTestClient; > > ULONG AddRef(); > ULONG Release(); >@@ -63,8 +71,8 @@ public: > > void showLastVisitedSites(IWebView&); > void launchInspector(); >- void navigateForwardOrBackward(HWND hWnd, UINT menuID); >- void navigateToHistory(HWND hWnd, UINT menuID); >+ void navigateForwardOrBackward(UINT menuID); >+ void navigateToHistory(UINT menuID); > void exitProgram(); > bool seedInitialDefaultPreferences(); > bool setToDefaultPreferences(); >@@ -106,7 +114,6 @@ public: > void updateStatistics(HWND dialog); > void setPreference(UINT menuID, bool enable); > >-private: > MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting); > void subclassForLayeredWindow(); > bool setCacheFolder(); >diff --git a/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp b/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >index c7e6ddd8524b4379a8fd33ff8114e046b69eee46..f4db4d247a48dcecec6bc9da5d2bafacc90b4f6f 100644 >--- a/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >+++ b/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >@@ -29,9 +29,7 @@ > > #include "Common.h" > #include "MainWindow.h" >-#if USE(CF) >-#include <CoreFoundation/CoreFoundation.h> >-#endif >+#include "MiniBrowser.h" > #include <WebCore/COMPtr.h> > #include <WebKitLegacy/WebKitCOMAPI.h> > #include <comip.h> >@@ -41,6 +39,10 @@ > #include <shlwapi.h> > #include <wininet.h> > >+#if USE(CF) >+#include <CoreFoundation/CoreFoundation.h> >+#endif >+ > static const int MARGIN = 20; > > HRESULT PrintWebUIDelegate::runJavaScriptAlertPanelWithMessage(_In_opt_ IWebView*, _In_ BSTR message) >@@ -69,7 +71,8 @@ HRESULT PrintWebUIDelegate::createWebViewWithRequest(_In_opt_ IWebView*, _In_opt > return E_FAIL; > ShowWindow(newWindow.hwnd(), SW_SHOW); > >- *newWebView = newWindow.browserWindow()->webView(); >+ auto& newBrowserWindow = *static_cast<MiniBrowser*>(newWindow.browserWindow()); >+ *newWebView = newBrowserWindow.webView(); > IWebFramePtr frame; > HRESULT hr; > hr = (*newWebView)->mainFrame(&frame.GetInterfacePtr());
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 186421
:
342233
| 342241