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

Unified Diff: chrome/common/service_process_util.cc

Issue 6591002: Removed the command line from ServiceProcessState::AddToAutoRun() and had the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
===================================================================
--- chrome/common/service_process_util.cc (revision 75945)
+++ chrome/common/service_process_util.cc (working copy)
@@ -4,6 +4,7 @@
#include <algorithm>
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -16,8 +17,10 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
+#include "chrome/common/child_process_host.h"
#include "chrome/common/chrome_constants.h"
#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"
@@ -158,6 +161,7 @@
#endif // !OS_MACOSX
ServiceProcessState::ServiceProcessState() : state_(NULL) {
+ CreateAutoRunCommandLine();
}
ServiceProcessState::~ServiceProcessState() {
@@ -258,3 +262,22 @@
}
#endif // !OS_MACOSX
+
+void ServiceProcessState::CreateAutoRunCommandLine() {
+ FilePath exe_path = ChildProcessHost::GetChildPath(false);
+ if (exe_path.empty()) {
+ NOTREACHED() << "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();
+ 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