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 |
25 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
26 #include "base/debug/dump_without_crashing.h" | 30 #include "base/debug/dump_without_crashing.h" |
27 #include "base/win/win_util.h" | 31 #include "base/win/win_util.h" |
28 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/install_static/initialize_from_primary_module.h" | 33 #include "chrome/install_static/initialize_from_primary_module.h" |
30 #include "chrome/install_static/install_details.h" | 34 #include "chrome/install_static/install_details.h" |
31 | 35 |
32 #define DLLEXPORT __declspec(dllexport) | 36 #define DLLEXPORT __declspec(dllexport) |
33 | 37 |
34 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 38 // 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... |
86 params.argc = argc; | 90 params.argc = argc; |
87 params.argv = argv; | 91 params.argv = argv; |
88 #endif | 92 #endif |
89 | 93 |
90 #if !defined(OS_WIN) | 94 #if !defined(OS_WIN) |
91 base::CommandLine::Init(params.argc, params.argv); | 95 base::CommandLine::Init(params.argc, params.argv); |
92 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 96 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
93 ALLOW_UNUSED_LOCAL(command_line); | 97 ALLOW_UNUSED_LOCAL(command_line); |
94 #endif | 98 #endif |
95 | 99 |
96 #if defined(OS_LINUX) | 100 #if defined(OS_LINUX) || defined(OS_MACOSX) |
97 if (command_line->HasSwitch(switches::kHeadless)) | 101 if (command_line->HasSwitch(switches::kHeadless)) { |
| 102 #if defined(OS_MACOSX) |
| 103 SetUpBundleOverrides(); |
| 104 #endif |
98 return headless::HeadlessShellMain(argc, argv); | 105 return headless::HeadlessShellMain(argc, argv); |
99 #endif // defined(OS_LINUX) | 106 } |
| 107 #endif // defined(OS_LINUX) || defined(OS_MACOSX) |
100 | 108 |
101 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 109 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
102 version_info::Channel channel = chrome::GetChannel(); | 110 version_info::Channel channel = chrome::GetChannel(); |
103 if (channel == version_info::Channel::CANARY || | 111 if (channel == version_info::Channel::CANARY || |
104 channel == version_info::Channel::UNKNOWN) { | 112 channel == version_info::Channel::UNKNOWN) { |
105 if (command_line->HasSwitch(switches::kMash)) | 113 if (command_line->HasSwitch(switches::kMash)) |
106 return MashMain(); | 114 return MashMain(); |
107 WaitForMashDebuggerIfNecessary(); | 115 WaitForMashDebuggerIfNecessary(); |
108 if (service_manager::ServiceManagerIsRemote()) | 116 if (service_manager::ServiceManagerIsRemote()) |
109 params.env_mode = aura::Env::Mode::MUS; | 117 params.env_mode = aura::Env::Mode::MUS; |
110 } | 118 } |
111 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 119 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
112 | 120 |
113 int rv = content::ContentMain(params); | 121 int rv = content::ContentMain(params); |
114 | 122 |
115 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
116 base::win::SetShouldCrashOnProcessDetach(false); | 124 base::win::SetShouldCrashOnProcessDetach(false); |
117 #endif | 125 #endif |
118 | 126 |
119 return rv; | 127 return rv; |
120 } | 128 } |
OLD | NEW |