Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1314)

Unified Diff: chrome/common/service_process_util.cc

Issue 347953002: Use the same set of switches for service process autorun and for launching process from browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thu 06/19/2014 19:02:33.22 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
-}

Powered by Google App Engine
This is Rietveld 408576698