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

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 23651006: Allow user data dir to be specified in the environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 623b20ab85a362b6a3b67476084389990bc04732..ac205858534837576d36d0588c84c4be7368bd0b 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -5,6 +5,7 @@
#include "chrome/app/chrome_main_delegate.h"
#include "base/command_line.h"
+#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
@@ -595,6 +596,13 @@ void ChromeMainDelegate::PreSandboxStartup() {
// Notice a user data directory override if any
base::FilePath user_data_dir =
command_line.GetSwitchValuePath(switches::kUserDataDir);
+ if (user_data_dir.empty()) {
+ std::string user_data_dir_string;
+ scoped_ptr<base::Environment> environment(base::Environment::Create());
+ if (environment->GetVar("CHROME_USER_DATA_DIR", &user_data_dir_string) &&
+ IsStringUTF8(user_data_dir_string))
+ user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string);
Wez 2013/08/28 21:06:41 nit: Braces around this, since the condition spans
Jamie 2013/09/09 20:13:00 Done.
+ }
#if defined(OS_MACOSX) || defined(OS_WIN)
policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698