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