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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/command_line.h" |
8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
9 #include "chrome/app/chrome_main_delegate.h" | 10 #include "chrome/app/chrome_main_delegate.h" |
10 #include "chrome/common/features.h" | 11 #include "chrome/common/features.h" |
11 #include "content/public/app/content_main.h" | 12 #include "content/public/app/content_main.h" |
| 13 #include "content/public/common/content_switches.h" |
| 14 #include "headless/public/headless_shell.h" |
| 15 #include "ui/gfx/switches.h" |
12 | 16 |
13 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 17 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
14 #include "base/command_line.h" | |
15 #include "chrome/app/mash/mash_runner.h" | 18 #include "chrome/app/mash/mash_runner.h" |
16 #include "chrome/common/channel_info.h" | 19 #include "chrome/common/channel_info.h" |
17 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
18 #endif | 21 #endif |
19 | 22 |
20 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
21 #include "base/debug/dump_without_crashing.h" | 24 #include "base/debug/dump_without_crashing.h" |
22 #include "base/win/win_util.h" | 25 #include "base/win/win_util.h" |
23 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/install_static/install_details.h" | 27 #include "chrome/install_static/install_details.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 86 |
84 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) | 87 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) |
85 // have the same version. | 88 // have the same version. |
86 if (install_static::InstallDetails::Get().VersionMismatch()) | 89 if (install_static::InstallDetails::Get().VersionMismatch()) |
87 base::debug::DumpWithoutCrashing(); | 90 base::debug::DumpWithoutCrashing(); |
88 #else | 91 #else |
89 params.argc = argc; | 92 params.argc = argc; |
90 params.argv = argv; | 93 params.argv = argv; |
91 #endif | 94 #endif |
92 | 95 |
93 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | |
94 #if !defined(OS_WIN) | 96 #if !defined(OS_WIN) |
95 base::CommandLine::Init(params.argc, params.argv); | 97 base::CommandLine::Init(params.argc, params.argv); |
| 98 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
| 99 ALLOW_UNUSED_LOCAL(command_line); |
96 #endif | 100 #endif |
97 | 101 |
| 102 #if defined(OS_LINUX) |
| 103 if (command_line->HasSwitch(switches::kHeadless)) |
| 104 return headless::HeadlessShellMain(argc, argv); |
| 105 #endif // defined(OS_LINUX) |
| 106 |
| 107 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
98 version_info::Channel channel = chrome::GetChannel(); | 108 version_info::Channel channel = chrome::GetChannel(); |
99 if (channel == version_info::Channel::CANARY || | 109 if (channel == version_info::Channel::CANARY || |
100 channel == version_info::Channel::UNKNOWN) { | 110 channel == version_info::Channel::UNKNOWN) { |
101 const base::CommandLine& command_line = | 111 if (command_line->HasSwitch("mash")) |
102 *base::CommandLine::ForCurrentProcess(); | |
103 if (command_line.HasSwitch("mash")) | |
104 return MashMain(); | 112 return MashMain(); |
105 } | 113 } |
106 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 114 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
107 | 115 |
108 int rv = content::ContentMain(params); | 116 int rv = content::ContentMain(params); |
109 | 117 |
110 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
111 base::win::SetShouldCrashOnProcessDetach(false); | 119 base::win::SetShouldCrashOnProcessDetach(false); |
112 #endif | 120 #endif |
113 | 121 |
114 return rv; | 122 return rv; |
115 } | 123 } |
OLD | NEW |