OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/app/chrome_main_delegate.h" | 10 #include "chrome/app/chrome_main_delegate.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/features.h" | 12 #include "chrome/common/features.h" |
13 #include "content/public/app/content_main.h" | 13 #include "content/public/app/content_main.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "headless/public/headless_shell.h" | 15 #include "headless/public/headless_shell.h" |
16 #include "ui/gfx/switches.h" | 16 #include "ui/gfx/switches.h" |
17 | 17 |
18 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 18 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
19 #include "chrome/app/mash/mash_runner.h" | 19 #include "chrome/app/mash/mash_runner.h" |
20 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
21 #include "components/version_info/version_info.h" | 21 #include "components/version_info/version_info.h" |
22 #include "services/service_manager/runner/common/client_util.h" | 22 #include "services/service_manager/runner/common/client_util.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(OS_MACOSX) | |
26 #include "chrome/app/chrome_main_mac.h" | |
27 #endif | |
28 | |
29 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
30 #include "base/debug/dump_without_crashing.h" | 26 #include "base/debug/dump_without_crashing.h" |
31 #include "base/win/win_util.h" | 27 #include "base/win/win_util.h" |
32 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/install_static/initialize_from_primary_module.h" | 29 #include "chrome/install_static/initialize_from_primary_module.h" |
34 #include "chrome/install_static/install_details.h" | 30 #include "chrome/install_static/install_details.h" |
35 | 31 |
36 #define DLLEXPORT __declspec(dllexport) | 32 #define DLLEXPORT __declspec(dllexport) |
37 | 33 |
38 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 34 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 params.argc = argc; | 86 params.argc = argc; |
91 params.argv = argv; | 87 params.argv = argv; |
92 #endif | 88 #endif |
93 | 89 |
94 #if !defined(OS_WIN) | 90 #if !defined(OS_WIN) |
95 base::CommandLine::Init(params.argc, params.argv); | 91 base::CommandLine::Init(params.argc, params.argv); |
96 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 92 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
97 ALLOW_UNUSED_LOCAL(command_line); | 93 ALLOW_UNUSED_LOCAL(command_line); |
98 #endif | 94 #endif |
99 | 95 |
100 #if defined(OS_LINUX) || defined(OS_MACOSX) | 96 #if defined(OS_LINUX) |
101 if (command_line->HasSwitch(switches::kHeadless)) { | 97 if (command_line->HasSwitch(switches::kHeadless)) |
102 #if defined(OS_MACOSX) | |
103 SetUpBundleOverrides(); | |
104 #endif | |
105 return headless::HeadlessShellMain(argc, argv); | 98 return headless::HeadlessShellMain(argc, argv); |
106 } | 99 #endif // defined(OS_LINUX) |
107 #endif // defined(OS_LINUX) || defined(OS_MACOSX) | |
108 | 100 |
109 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 101 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
110 version_info::Channel channel = chrome::GetChannel(); | 102 version_info::Channel channel = chrome::GetChannel(); |
111 if (channel == version_info::Channel::CANARY || | 103 if (channel == version_info::Channel::CANARY || |
112 channel == version_info::Channel::UNKNOWN) { | 104 channel == version_info::Channel::UNKNOWN) { |
113 if (command_line->HasSwitch(switches::kMash)) | 105 if (command_line->HasSwitch(switches::kMash)) |
114 return MashMain(); | 106 return MashMain(); |
115 WaitForMashDebuggerIfNecessary(); | 107 WaitForMashDebuggerIfNecessary(); |
116 if (service_manager::ServiceManagerIsRemote()) | 108 if (service_manager::ServiceManagerIsRemote()) |
117 params.env_mode = aura::Env::Mode::MUS; | 109 params.env_mode = aura::Env::Mode::MUS; |
118 } | 110 } |
119 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 111 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
120 | 112 |
121 int rv = content::ContentMain(params); | 113 int rv = content::ContentMain(params); |
122 | 114 |
123 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
124 base::win::SetShouldCrashOnProcessDetach(false); | 116 base::win::SetShouldCrashOnProcessDetach(false); |
125 #endif | 117 #endif |
126 | 118 |
127 return rv; | 119 return rv; |
128 } | 120 } |
OLD | NEW |