diff options
Diffstat (limited to 'chrome/app/chrome_exe_main_win.cc')
-rw-r--r-- | chrome/app/chrome_exe_main_win.cc | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/chrome/app/chrome_exe_main_win.cc b/chrome/app/chrome_exe_main_win.cc index 3c93752..51b1edf 100644 --- a/chrome/app/chrome_exe_main_win.cc +++ b/chrome/app/chrome_exe_main_win.cc @@ -13,6 +13,7 @@ #include "base/lazy_instance.h" #include "chrome/app/chrome_breakpad_client.h" #include "chrome/app/client_util.h" +#include "chrome/app/metro_driver_win.h" #include "chrome/browser/chrome_process_finder_win.h" #include "chrome/browser/policy/policy_path_parser.h" #include "chrome/common/chrome_constants.h" @@ -40,6 +41,36 @@ void CheckSafeModeLaunch() { ::SetEnvironmentVariableA(chrome::kSafeModeEnvVar, "1"); } +int RunChrome(HINSTANCE instance) { + breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer()); + + CheckSafeModeLaunch(); + + bool exit_now = true; + // We restarted because of a previous crash. Ask user if we should relaunch. + // Only show this for the browser process. See crbug.com/132119. + const std::string process_type = + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kProcessType); + if (process_type.empty()) { + if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { + if (exit_now) + return content::RESULT_CODE_NORMAL_EXIT; + } + } + + // Initialize the sandbox services. + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + + // Load and launch the chrome dll. *Everything* happens inside. + MainDllLoader* loader = MakeMainDllLoader(); + int rc = loader->Launch(instance, &sandbox_info); + loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); + delete loader; + return rc; +} + // List of switches that it's safe to rendezvous early with. Fast start should // not be done if a command line contains a switch not in this set. // Note this is currently stored as a list of two because it's probably faster @@ -104,29 +135,9 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { if (AttemptFastNotify(*CommandLine::ForCurrentProcess())) return 0; - breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer()); - CheckSafeModeLaunch(); - - bool exit_now = true; - // We restarted because of a previous crash. Ask user if we should relaunch. - // Only show this for the browser process. See crbug.com/132119. - bool const is_browser = - CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kProcessType).empty(); - if (is_browser) { - if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { - if (exit_now) - return content::RESULT_CODE_NORMAL_EXIT; - } - } - - // Initialize the sandbox services. - sandbox::SandboxInterfaceInfo sandbox_info = {0}; - content::InitializeSandboxInfo(&sandbox_info); - // Load and launch the chrome dll. *Everything* happens inside. - MainDllLoader* loader = MakeMainDllLoader(); - int rc = loader->Launch(instance, &sandbox_info); - loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); - delete loader; - return rc; + MetroDriver metro_driver; + if (metro_driver.in_metro_mode()) + return metro_driver.RunInMetro(instance, &RunChrome); + // Not in metro mode, proceed as normal. + return RunChrome(instance); } |