OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include <tchar.h> | 6 #include <tchar.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/win_util.h" | 10 #include "base/win/windows_version.h" |
11 #include "chrome/app/breakpad_win.h" | 11 #include "chrome/app/breakpad_win.h" |
12 #include "chrome/app/client_util.h" | 12 #include "chrome/app/client_util.h" |
13 #include "chrome/common/result_codes.h" | 13 #include "chrome/common/result_codes.h" |
14 #include "sandbox/src/dep.h" | 14 #include "sandbox/src/dep.h" |
15 #include "sandbox/src/sandbox_factory.h" | 15 #include "sandbox/src/sandbox_factory.h" |
16 | 16 |
17 | 17 |
18 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { | 18 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { |
19 base::EnableTerminationOnHeapCorruption(); | 19 base::EnableTerminationOnHeapCorruption(); |
20 | 20 |
21 // The exit manager is in charge of calling the dtors of singletons. | 21 // The exit manager is in charge of calling the dtors of singletons. |
22 base::AtExitManager exit_manager; | 22 base::AtExitManager exit_manager; |
23 | 23 |
24 bool exit_now = true; | 24 bool exit_now = true; |
25 // We restarted because of a previous crash. Ask user if we should relaunch. | 25 // We restarted because of a previous crash. Ask user if we should relaunch. |
26 if (ShowRestartDialogIfCrashed(&exit_now)) { | 26 if (ShowRestartDialogIfCrashed(&exit_now)) { |
27 if (exit_now) | 27 if (exit_now) |
28 return ResultCodes::NORMAL_EXIT; | 28 return ResultCodes::NORMAL_EXIT; |
29 } | 29 } |
30 | 30 |
31 // Initialize the commandline singleton from the environment. | 31 // Initialize the commandline singleton from the environment. |
32 CommandLine::Init(0, NULL); | 32 CommandLine::Init(0, NULL); |
33 | 33 |
34 // Initialize the sandbox services. | 34 // Initialize the sandbox services. |
35 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 35 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
36 sandbox_info.broker_services = sandbox::SandboxFactory::GetBrokerServices(); | 36 sandbox_info.broker_services = sandbox::SandboxFactory::GetBrokerServices(); |
37 if (!sandbox_info.broker_services) | 37 if (!sandbox_info.broker_services) |
38 sandbox_info.target_services = sandbox::SandboxFactory::GetTargetServices(); | 38 sandbox_info.target_services = sandbox::SandboxFactory::GetTargetServices(); |
39 | 39 |
40 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 40 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
41 // Enforces strong DEP support. Vista uses the NXCOMPAT flag in the exe. | 41 // Enforces strong DEP support. Vista uses the NXCOMPAT flag in the exe. |
42 sandbox::SetCurrentProcessDEP(sandbox::DEP_ENABLED); | 42 sandbox::SetCurrentProcessDEP(sandbox::DEP_ENABLED); |
43 } | 43 } |
44 // Load and launch the chrome dll. *Everything* happens inside. | 44 // Load and launch the chrome dll. *Everything* happens inside. |
45 MainDllLoader* loader = MakeMainDllLoader(); | 45 MainDllLoader* loader = MakeMainDllLoader(); |
46 int rc = loader->Launch(instance, &sandbox_info); | 46 int rc = loader->Launch(instance, &sandbox_info); |
47 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 47 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
48 delete loader; | 48 delete loader; |
49 | 49 |
50 return rc; | 50 return rc; |
51 } | 51 } |
OLD | NEW |