Chromium Code Reviews| Index: chrome/common/service_process_util.cc |
| diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc |
| index 0b239a2b81570728cf020a528777ca32ca9f45fe..e5f5ffc26307df7c391f28a9fd6d3861abf8e6c4 100644 |
| --- a/chrome/common/service_process_util.cc |
| +++ b/chrome/common/service_process_util.cc |
| @@ -2,6 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "chrome/common/service_process_util.h" |
| + |
| #include <algorithm> |
| #include "base/command_line.h" |
| @@ -18,8 +20,10 @@ |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/chrome_version_info.h" |
| -#include "chrome/common/service_process_util.h" |
| +#include "components/cloud_devices/common/cloud_devices_switches.h" |
| #include "content/public/common/content_paths.h" |
| +#include "google_apis/gaia/gaia_switches.h" |
| +#include "ui/base/ui_base_switches.h" |
| #if !defined(OS_MACOSX) |
| @@ -151,8 +155,39 @@ bool GetServiceProcessData(std::string* version, base::ProcessId* pid) { |
| #endif // !OS_MACOSX |
| +scoped_ptr<base::CommandLine> CreateServiceProcessCommandLine() { |
| + base::FilePath exe_path; |
| + PathService::Get(content::CHILD_PROCESS_EXE, &exe_path); |
| + DCHECK(!exe_path.empty()) << "Unable to get service process binary name."; |
| + scoped_ptr<base::CommandLine> command_line(new CommandLine(exe_path)); |
|
Lei Zhang
2014/06/20 02:50:29
new base::CommandLine
Vitaly Buka (NO REVIEWS)
2014/06/20 04:38:43
Done.
|
| + command_line->AppendSwitchASCII(switches::kProcessType, |
| + switches::kServiceProcess); |
| + static const char* const kSwitches[] = { |
|
Lei Zhang
2014/06/20 02:50:29
kSwitchesToCopy?
Vitaly Buka (NO REVIEWS)
2014/06/20 04:38:43
Done.
|
| + switches::kCloudPrintSetupProxy, |
| + switches::kCloudPrintURL, |
| + switches::kCloudPrintXmppEndpoint, |
| +#if defined(OS_WIN) |
| + switches::kEnableCloudPrintXps, |
| +#endif |
| + switches::kEnableLogging, |
| + switches::kIgnoreUrlFetcherCertRequests, |
| + switches::kLang, |
| + switches::kLoggingLevel, |
| + switches::kLsoUrl, |
| + switches::kNoServiceAutorun, |
| + switches::kUserDataDir, |
| + switches::kV, |
| + switches::kVModule, |
| + switches::kWaitForDebugger, |
| + }; |
| + |
| + command_line->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
|
Lei Zhang
2014/06/20 02:50:29
base::CommandLine
Vitaly Buka (NO REVIEWS)
2014/06/20 04:38:43
Done.
|
| + kSwitches, arraysize(kSwitches)); |
| + return command_line.Pass(); |
| +} |
| + |
| ServiceProcessState::ServiceProcessState() : state_(NULL) { |
| - CreateAutoRunCommandLine(); |
| + autorun_command_line_ = CreateServiceProcessCommandLine(); |
| CreateState(); |
| } |
| @@ -247,21 +282,3 @@ IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { |
| } |
| #endif // !OS_MACOSX |
| - |
| -void ServiceProcessState::CreateAutoRunCommandLine() { |
| - base::FilePath exe_path; |
| - PathService::Get(content::CHILD_PROCESS_EXE, &exe_path); |
| - DCHECK(!exe_path.empty()) << "Unable to get service process binary name."; |
| - autorun_command_line_.reset(new CommandLine(exe_path)); |
| - autorun_command_line_->AppendSwitchASCII(switches::kProcessType, |
| - switches::kServiceProcess); |
| - |
| - // The user data directory is the only other flag we currently want to |
| - // possibly store. |
| - const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| - base::FilePath user_data_dir = |
| - browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
| - if (!user_data_dir.empty()) |
| - autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, |
| - user_data_dir); |
| -} |