[Win][MiniBrowser] Change to use WebKit by default if it's available
https://bugs.webkit.org/show_bug.cgi?id=186633
When MiniBrowser is built with WebKit, use it by default. Also add command
line switch for WebKitLegacy.
Reviewed by Youenn Fablet.
* MiniBrowser/win/Common.cpp:
(parseCommandLine):
(dllLauncherEntryPoint): Deleted.
* MiniBrowser/win/Common.h:
* MiniBrowser/win/WinMain.cpp:
(wWinMain):
(dllLauncherEntryPoint):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 2e76256..656706c 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,21 @@
+2018-06-14 Basuke Suzuki <Basuke.Suzuki@sony.com>
+
+ [Win][MiniBrowser] Change to use WebKit by default if it's available
+ https://bugs.webkit.org/show_bug.cgi?id=186633
+
+ When MiniBrowser is built with WebKit, use it by default. Also add command
+ line switch for WebKitLegacy.
+
+ Reviewed by Youenn Fablet.
+
+ * MiniBrowser/win/Common.cpp:
+ (parseCommandLine):
+ (dllLauncherEntryPoint): Deleted.
+ * MiniBrowser/win/Common.h:
+ * MiniBrowser/win/WinMain.cpp:
+ (wWinMain):
+ (dllLauncherEntryPoint):
+
2018-06-14 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r232823.
diff --git a/Tools/MiniBrowser/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp
index fa25f54..3588fc4 100644
--- a/Tools/MiniBrowser/win/Common.cpp
+++ b/Tools/MiniBrowser/win/Common.cpp
@@ -165,29 +165,30 @@
return result > 0 ? S_OK : E_FAIL;
}
-void parseCommandLine(bool& usesLayeredWebView, bool& useFullDesktop, bool& pageLoadTesting, _bstr_t& requestedURL)
+CommandLineOptions parseCommandLine()
{
- usesLayeredWebView = false;
- useFullDesktop = false;
- pageLoadTesting = false;
+ CommandLineOptions options;
int argc = 0;
WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
for (int i = 1; i < argc; ++i) {
if (!wcsicmp(argv[i], L"--transparent"))
- usesLayeredWebView = true;
+ options.usesLayeredWebView = true;
else if (!wcsicmp(argv[i], L"--desktop"))
- useFullDesktop = true;
+ options.useFullDesktop = true;
else if (!wcsicmp(argv[i], L"--performance"))
- pageLoadTesting = true;
+ options.pageLoadTesting = true;
else if (!wcsicmp(argv[i], L"--highDPI"))
continue; // ignore
- else if (!requestedURL)
- requestedURL = argv[i];
+ else if (!wcsicmp(argv[i], L"--wk1") || !wcsicmp(argv[i], L"--legacy"))
+ options.windowType = MainWindow::BrowserWindowType::WebKitLegacy;
+#if ENABLE(WEBKIT)
+ else if (!wcsicmp(argv[i], L"--wk2") || !wcsicmp(argv[i], L"--webkit"))
+ options.windowType = MainWindow::BrowserWindowType::WebKit;
+#endif
+ else if (!options.requestedURL)
+ options.requestedURL = argv[i];
}
-}
-extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
-{
- return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
+ return options;
}
diff --git a/Tools/MiniBrowser/win/Common.h b/Tools/MiniBrowser/win/Common.h
index 985fe77..085a313 100644
--- a/Tools/MiniBrowser/win/Common.h
+++ b/Tools/MiniBrowser/win/Common.h
@@ -29,9 +29,26 @@
#include "MainWindow.h"
#include "WebKitLegacyBrowserWindow.h"
+struct CommandLineOptions {
+ bool usesLayeredWebView { };
+ bool useFullDesktop { };
+ bool pageLoadTesting { };
+ MainWindow::BrowserWindowType windowType;
+ _bstr_t requestedURL;
+
+ CommandLineOptions()
+#if ENABLE(WEBKIT)
+ : windowType(MainWindow::BrowserWindowType::WebKit)
+#else
+ : windowType(MainWindow::BrowserWindowType::WebKitLegacy)
+#endif
+ {
+ }
+};
+
void computeFullDesktopFrame();
bool getAppDataFolder(_bstr_t& directory);
-void parseCommandLine(bool& usesLayeredWebView, bool& useFullDesktop, bool& pageLoadTesting, _bstr_t& requestedURL);
+CommandLineOptions parseCommandLine();
void createCrashReport(EXCEPTION_POINTERS*);
HRESULT displayAuthDialog(HWND, std::wstring& username, std::wstring& password);
diff --git a/Tools/MiniBrowser/win/WinMain.cpp b/Tools/MiniBrowser/win/WinMain.cpp
index c96a677..426a09e 100644
--- a/Tools/MiniBrowser/win/WinMain.cpp
+++ b/Tools/MiniBrowser/win/WinMain.cpp
@@ -50,14 +50,9 @@
InitCtrlEx.dwICC = 0x00004000; // ICC_STANDARD_CLASSES;
InitCommonControlsEx(&InitCtrlEx);
- bool usesLayeredWebView = false;
- bool useFullDesktop = false;
- bool pageLoadTesting = false;
- _bstr_t requestedURL;
+ auto options = parseCommandLine();
- parseCommandLine(usesLayeredWebView, useFullDesktop, pageLoadTesting, requestedURL);
-
- if (useFullDesktop)
+ if (options.useFullDesktop)
computeFullDesktopFrame();
// Init COM
@@ -65,8 +60,8 @@
::SetProcessDPIAware();
- auto& mainWindow = MainWindow::create(MainWindow::BrowserWindowType::WebKitLegacy).leakRef();
- HRESULT hr = mainWindow.init(hInst, usesLayeredWebView, pageLoadTesting);
+ auto& mainWindow = MainWindow::create(options.windowType).leakRef();
+ HRESULT hr = mainWindow.init(hInst, options.usesLayeredWebView, options.pageLoadTesting);
if (FAILED(hr))
goto exit;
@@ -74,8 +69,8 @@
hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_MINIBROWSER));
- if (requestedURL.length())
- mainWindow.loadURL(requestedURL.GetBSTR());
+ if (options.requestedURL.length())
+ mainWindow.loadURL(options.requestedURL.GetBSTR());
else
mainWindow.browserWindow()->loadHTMLString(_bstr_t(defaultHTML).GetBSTR());
@@ -104,3 +99,8 @@
return static_cast<int>(msg.wParam);
}
+
+extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
+{
+ return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
+}