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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 78 |
76 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) | 79 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) |
77 // have the same version. | 80 // have the same version. |
78 if (install_static::InstallDetails::Get().VersionMismatch()) | 81 if (install_static::InstallDetails::Get().VersionMismatch()) |
79 base::debug::DumpWithoutCrashing(); | 82 base::debug::DumpWithoutCrashing(); |
80 #else | 83 #else |
81 params.argc = argc; | 84 params.argc = argc; |
82 params.argv = argv; | 85 params.argv = argv; |
83 #endif | 86 #endif |
84 | 87 |
85 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | |
86 #if !defined(OS_WIN) | 88 #if !defined(OS_WIN) |
87 base::CommandLine::Init(params.argc, params.argv); | 89 base::CommandLine::Init(params.argc, params.argv); |
| 90 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
| 91 ALLOW_UNUSED_LOCAL(command_line); |
88 #endif | 92 #endif |
89 | 93 |
| 94 #if defined(OS_LINUX) |
| 95 if (command_line->HasSwitch(switches::kHeadless)) |
| 96 return headless::HeadlessShellMain(argc, argv); |
| 97 #endif // defined(OS_LINUX) |
| 98 |
| 99 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
90 version_info::Channel channel = chrome::GetChannel(); | 100 version_info::Channel channel = chrome::GetChannel(); |
91 if (channel == version_info::Channel::CANARY || | 101 if (channel == version_info::Channel::CANARY || |
92 channel == version_info::Channel::UNKNOWN) { | 102 channel == version_info::Channel::UNKNOWN) { |
93 const base::CommandLine& command_line = | 103 if (command_line->HasSwitch("mash")) |
94 *base::CommandLine::ForCurrentProcess(); | |
95 if (command_line.HasSwitch("mash")) | |
96 return MashMain(); | 104 return MashMain(); |
97 } | 105 } |
98 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 106 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
99 | 107 |
100 int rv = content::ContentMain(params); | 108 int rv = content::ContentMain(params); |
101 | 109 |
102 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
103 base::win::SetShouldCrashOnProcessDetach(false); | 111 base::win::SetShouldCrashOnProcessDetach(false); |
104 #endif | 112 #endif |
105 | 113 |
106 return rv; | 114 return rv; |
107 } | 115 } |
OLD | NEW |