OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/utility_process_host.h" | 5 #include "chrome/browser/utility_process_host.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 cmd_line.AppendSwitchWithValue(switches::kProcessType, | 90 cmd_line.AppendSwitchWithValue(switches::kProcessType, |
91 switches::kUtilityProcess); | 91 switches::kUtilityProcess); |
92 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, | 92 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, |
93 ASCIIToWide(channel_id())); | 93 ASCIIToWide(channel_id())); |
94 // Pass on the browser locale. | 94 // Pass on the browser locale. |
95 std::string locale = l10n_util::GetApplicationLocale(L""); | 95 std::string locale = l10n_util::GetApplicationLocale(L""); |
96 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); | 96 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); |
97 | 97 |
98 SetCrashReporterCommandLine(&cmd_line); | 98 SetCrashReporterCommandLine(&cmd_line); |
99 | 99 |
| 100 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 101 if (browser_command_line.HasSwitch(switches::kChromeFrame)) { |
| 102 cmd_line.AppendSwitch(switches::kChromeFrame); |
| 103 } |
| 104 |
100 base::ProcessHandle process; | 105 base::ProcessHandle process; |
101 #if defined(OS_WIN) | 106 #if defined(OS_WIN) |
102 if (!UseSandbox()) { | 107 if (!UseSandbox()) { |
103 // Don't use the sandbox during unit tests. | 108 // Don't use the sandbox during unit tests. |
104 base::LaunchApp(cmd_line, false, false, &process); | 109 base::LaunchApp(cmd_line, false, false, &process); |
105 } else if (exposed_dir.empty()) { | 110 } else if (exposed_dir.empty()) { |
106 process = sandbox::StartProcess(&cmd_line); | 111 process = sandbox::StartProcess(&cmd_line); |
107 } else { | 112 } else { |
108 process = sandbox::StartProcessWithAccess(&cmd_line, exposed_dir); | 113 process = sandbox::StartProcessWithAccess(&cmd_line, exposed_dir); |
109 } | 114 } |
110 #else | 115 #else |
111 // TODO(port): Sandbox this on Linux/Mac. Also, zygote this to work with | 116 // TODO(port): Sandbox this on Linux/Mac. Also, zygote this to work with |
112 // Linux updating. | 117 // Linux updating. |
113 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | |
114 bool has_cmd_prefix = browser_command_line.HasSwitch( | 118 bool has_cmd_prefix = browser_command_line.HasSwitch( |
115 switches::kUtilityCmdPrefix); | 119 switches::kUtilityCmdPrefix); |
116 if (has_cmd_prefix) { | 120 if (has_cmd_prefix) { |
117 // launch the utility child process with some prefix (usually "xterm -e gdb | 121 // launch the utility child process with some prefix (usually "xterm -e gdb |
118 // --args"). | 122 // --args"). |
119 cmd_line.PrependWrapper(browser_command_line.GetSwitchValue( | 123 cmd_line.PrependWrapper(browser_command_line.GetSwitchValue( |
120 switches::kUtilityCmdPrefix)); | 124 switches::kUtilityCmdPrefix)); |
121 } | 125 } |
122 | 126 |
123 // This code is duplicated with browser_render_process_host.cc and | 127 // This code is duplicated with browser_render_process_host.cc and |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, | 168 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, |
165 Client::OnUnpackWebResourceSucceeded) | 169 Client::OnUnpackWebResourceSucceeded) |
166 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, | 170 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, |
167 Client::OnUnpackWebResourceFailed) | 171 Client::OnUnpackWebResourceFailed) |
168 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, | 172 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, |
169 Client::OnParseUpdateManifestSucceeded) | 173 Client::OnParseUpdateManifestSucceeded) |
170 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, | 174 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, |
171 Client::OnParseUpdateManifestFailed) | 175 Client::OnParseUpdateManifestFailed) |
172 IPC_END_MESSAGE_MAP_EX() | 176 IPC_END_MESSAGE_MAP_EX() |
173 } | 177 } |
OLD | NEW |