Changeset 232616 in webkit
- Timestamp:
- Jun 7, 2018 10:14:03 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r232609 r232616 1 2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [Win][MiniBrowser] Add a new BrowserWindow interface to abstract WK1 and WK2 BrowserWindow 4 https://bugs.webkit.org/show_bug.cgi?id=186421 5 6 Reviewed by Ryosuke Niwa. 7 8 This is the core patch to make MiniBrowser to support WK1 and WK2 9 windows (Bug 184770). 10 11 I will rename MiniBrowser class to WK1BrowserWindow in a follow-up 12 patch (Bug 184770 Comment 12). 13 14 * MiniBrowser/win/BrowserWindow.h: Added. 15 * MiniBrowser/win/MainWindow.cpp: 16 (MainWindow::WndProc): 17 * MiniBrowser/win/MainWindow.h: 18 (MainWindow::browserWindow const): 19 * MiniBrowser/win/MiniBrowser.cpp: 20 (MiniBrowser::create): 21 (MiniBrowser::navigateForwardOrBackward): Removed the unsed first argument hWnd. 22 (MiniBrowser::navigateToHistory): Ditto. 23 * MiniBrowser/win/MiniBrowser.h: Inherit BrowserWindow interface. 24 Make all other methods private and make delegates classes friends. 25 * MiniBrowser/win/PrintWebUIDelegate.cpp: 26 (PrintWebUIDelegate::createWebViewWithRequest): 27 1 28 2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> 2 29 -
trunk/Tools/MiniBrowser/win/BrowserWindow.h
r232615 r232616 26 26 #pragma once 27 27 28 #include "MiniBrowser.h" 29 #include <memory> 30 #include <string> 31 #include <wtf/RefPtr.h> 28 #include <windows.h> 29 #include <wtf/RefCounted.h> 32 30 33 class MainWindow : public RefCounted<MainWindow> {31 class BrowserWindow : public RefCounted<BrowserWindow> { 34 32 public: 35 static Ref<MainWindow> create();33 virtual ~BrowserWindow() { }; 36 34 37 ~MainWindow();38 bool init(HINSTANCE hInstance, bool usesLayeredWebView = false, bool pageLoadTesting = false);35 virtual HRESULT init() = 0; 36 virtual HWND hwnd() = 0; 39 37 40 void resizeSubViews(); 41 HWND hwnd() const { return m_hMainWnd; } 42 MiniBrowser* browserWindow() const { return m_browserWindow.get(); } 38 virtual HRESULT loadHTMLString(const BSTR&) = 0; 39 virtual HRESULT loadURL(const BSTR& passedURL) = 0; 40 virtual void navigateForwardOrBackward(UINT menuID) = 0; 41 virtual void navigateToHistory(UINT menuID) = 0; 42 virtual void setPreference(UINT menuID, bool enable) = 0; 43 virtual bool usesLayeredWebView() const { return false; } 43 44 44 void loadURL(BSTR url); 45 46 private: 47 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 48 static INT_PTR CALLBACK customUserAgentDialogProc(HWND, UINT, WPARAM, LPARAM); 49 static INT_PTR CALLBACK cachesDialogProc(HWND, UINT, WPARAM, LPARAM); 50 static void registerClass(HINSTANCE hInstance); 51 static std::wstring s_windowClass; 52 static size_t s_numInstances; 45 virtual void print() = 0; 46 virtual void launchInspector() = 0; 53 47 54 MainWindow(); 55 bool toggleMenuItem(UINT menuID); 56 void onURLBarEnter(); 57 void updateDeviceScaleFactor(); 48 virtual _bstr_t userAgent() = 0; 49 virtual void setUserAgent(UINT menuID) = 0; 50 virtual void setUserAgent(_bstr_t& customUAString) = 0; 58 51 59 HWND m_hMainWnd { nullptr }; 60 HWND m_hURLBarWnd { nullptr }; 61 HWND m_hBackButtonWnd { nullptr }; 62 HWND m_hForwardButtonWnd { nullptr }; 63 HWND m_hCacheWnd { nullptr }; 64 HGDIOBJ m_hURLBarFont { nullptr }; 65 RefPtr<MiniBrowser> m_browserWindow; 52 virtual void showLayerTree() = 0; 53 virtual void updateStatistics(HWND dialog) = 0; 54 55 virtual void resetZoom() = 0; 56 virtual void zoomIn() = 0; 57 virtual void zoomOut() = 0; 66 58 }; -
trunk/Tools/MiniBrowser/win/MainWindow.cpp
r232609 r232616 164 164 } 165 165 if (wmId >= IDM_HISTORY_LINK0 && wmId <= IDM_HISTORY_LINK9) { 166 thisWindow->browserWindow()->navigateToHistory( hWnd,wmId);166 thisWindow->browserWindow()->navigateToHistory(wmId); 167 167 break; 168 168 } … … 192 192 case IDM_HISTORY_BACKWARD: 193 193 case IDM_HISTORY_FORWARD: 194 thisWindow->browserWindow()->navigateForwardOrBackward( hWnd,wmId);194 thisWindow->browserWindow()->navigateForwardOrBackward(wmId); 195 195 break; 196 196 case IDM_UA_OTHER: -
trunk/Tools/MiniBrowser/win/MainWindow.h
r232609 r232616 40 40 void resizeSubViews(); 41 41 HWND hwnd() const { return m_hMainWnd; } 42 MiniBrowser* browserWindow() const { return m_browserWindow.get(); }42 BrowserWindow* browserWindow() const { return m_browserWindow.get(); } 43 43 44 44 void loadURL(BSTR url); … … 63 63 HWND m_hCacheWnd { nullptr }; 64 64 HGDIOBJ m_hURLBarFont { nullptr }; 65 RefPtr< MiniBrowser> m_browserWindow;65 RefPtr<BrowserWindow> m_browserWindow; 66 66 }; -
trunk/Tools/MiniBrowser/win/MiniBrowser.cpp
r232609 r232616 61 61 typedef _com_ptr_t<_com_IIID<IWebMutableURLRequest, &__uuidof(IWebMutableURLRequest)>> IWebMutableURLRequestPtr; 62 62 63 Ref< MiniBrowser> MiniBrowser::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting)63 Ref<BrowserWindow> MiniBrowser::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting) 64 64 { 65 65 return adoptRef(*new MiniBrowser(mainWnd, urlBarWnd, useLayeredWebView, pageLoadTesting)); … … 431 431 } 432 432 433 void MiniBrowser::navigateForwardOrBackward( HWND hWnd,UINT menuID)433 void MiniBrowser::navigateForwardOrBackward(UINT menuID) 434 434 { 435 435 if (!m_webView) … … 443 443 } 444 444 445 void MiniBrowser::navigateToHistory( HWND hWnd,UINT menuID)445 void MiniBrowser::navigateToHistory(UINT menuID) 446 446 { 447 447 if (!m_webView) -
trunk/Tools/MiniBrowser/win/MiniBrowser.h
r232609 r232616 25 25 26 26 #pragma once 27 #include "BrowserWindow.h" 27 28 #include "PageLoadTestClient.h" 28 29 #include <WebKitLegacy/WebKit.h> … … 30 31 #include <memory> 31 32 #include <vector> 32 #include <wtf/RefCounted.h>33 33 34 34 typedef _com_ptr_t<_com_IIID<IWebFrame, &__uuidof(IWebFrame)>> IWebFramePtr; … … 49 49 typedef _com_ptr_t<_com_IIID<IWebFramePrivate, &__uuidof(IWebFramePrivate)>> IWebFramePrivatePtr; 50 50 51 class MiniBrowser : public RefCounted<MiniBrowser>{51 class MiniBrowser : public BrowserWindow { 52 52 public: 53 static Ref<MiniBrowser> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); 53 static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); 54 55 private: 56 friend class AccessibilityDelegate; 57 friend class MiniBrowserWebHost; 58 friend class PrintWebUIDelegate; 59 friend class WebDownloadDelegate; 60 friend class ResourceLoadDelegate; 61 friend class PageLoadTestClient; 54 62 55 63 ULONG AddRef(); … … 64 72 void showLastVisitedSites(IWebView&); 65 73 void launchInspector(); 66 void navigateForwardOrBackward( HWND hWnd,UINT menuID);67 void navigateToHistory( HWND hWnd,UINT menuID);74 void navigateForwardOrBackward(UINT menuID); 75 void navigateToHistory(UINT menuID); 68 76 void exitProgram(); 69 77 bool seedInitialDefaultPreferences(); … … 107 115 void setPreference(UINT menuID, bool enable); 108 116 109 private:110 117 MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting); 111 118 void subclassForLayeredWindow(); -
trunk/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp
r232577 r232616 30 30 #include "Common.h" 31 31 #include "MainWindow.h" 32 #if USE(CF) 33 #include <CoreFoundation/CoreFoundation.h> 34 #endif 32 #include "MiniBrowser.h" 35 33 #include <WebCore/COMPtr.h> 36 34 #include <WebKitLegacy/WebKitCOMAPI.h> … … 42 40 #include <wininet.h> 43 41 42 #if USE(CF) 43 #include <CoreFoundation/CoreFoundation.h> 44 #endif 45 44 46 static const int MARGIN = 20; 45 47 … … 70 72 ShowWindow(newWindow.hwnd(), SW_SHOW); 71 73 72 *newWebView = newWindow.browserWindow()->webView(); 74 auto& newBrowserWindow = *static_cast<MiniBrowser*>(newWindow.browserWindow()); 75 *newWebView = newBrowserWindow.webView(); 73 76 IWebFramePtr frame; 74 77 HRESULT hr;
Note: See TracChangeset
for help on using the changeset viewer.