// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include #include "base/at_exit.h" #include "base/command_line.h" #include "chrome/app/breakpad_win.h" #include "chrome/app/client_util.h" #include "chrome/app/metro_driver_win.h" #include "content/public/app/startup_helper_win.h" #include "content/public/common/result_codes.h" #include "sandbox/win/src/sandbox_factory.h" int RunChrome(HINSTANCE instance) { bool exit_now = true; // We restarted because of a previous crash. Ask user if we should relaunch. if (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; } int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { // Initialize the commandline singleton from the environment. CommandLine::Init(0, NULL); // The exit manager is in charge of calling the dtors of singletons. base::AtExitManager exit_manager; 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); }