summaryrefslogtreecommitdiffstats
path: root/chrome/common/chrome_paths.cc
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 14:19:58 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 14:19:58 +0000
commita5827b97be2b4e4f64b87276c6939208aed6142d (patch)
tree0a9ffea2c1febdcfd243b2c7a03e4d4674bfaef5 /chrome/common/chrome_paths.cc
parent6c77d6428efb9c478a6f44fdf04d8c68d81aba44 (diff)
downloadchromium_src-a5827b97be2b4e4f64b87276c6939208aed6142d.zip
chromium_src-a5827b97be2b4e4f64b87276c6939208aed6142d.tar.gz
chromium_src-a5827b97be2b4e4f64b87276c6939208aed6142d.tar.bz2
Initialize chrome::DIR_USER_DATA early on for service processes, etc.
http://crrev.com/251126 broke service/helper processes. (--user-data-dir command-line args weren't respected) Restore the early PathService DIR_USER_DATA init/override. (done as before in ChromeMainDelegate::PreSandboxStartup) Move init code to a file-local InitializeUserDataDir helper. Append the fallback to the commandline for other processes. (otherwise child/service processes re-use the bad dir) Simplify ChromeBrowserMainParts::PreCreateThreadsImpl. (just get DIR_USER_DATA, don't re-attempt init/override) Show a warning messagebox here if user-data-dir was invalid. Move warning UI helper to c/b/ui/startup/bad_flags_prompt.h Add [Get|Set]InvalidSpecifiedUserDataDir for warning UI. (add dynamic_annotations dependency for LazyInstance usage) Remove the ChromeMainUserDataDirTest.GetUserDataDir test. (now ineffective, it can't hook before PreSandboxStartup) BUG=345025,345582,318999 TEST=The --user-data-dir command-line argument works as expected for browser, child, and service processes (cloud print connector, chrome logging, etc.). Users are still warned with a dialog when they supply invalid or restricted directory paths for the browser. R=sky@chromium.org,vitalybuka@chromium.org Review URL: https://codereview.chromium.org/174253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_paths.cc')
-rw-r--r--chrome/common/chrome_paths.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 7014ed3..e9d841f 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -5,6 +5,7 @@
#include "chrome/common/chrome_paths.h"
#include "base/file_util.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/path_service.h"
@@ -94,9 +95,8 @@ const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
#endif // defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_LINUX)
-} // namespace
-
-namespace chrome {
+static base::LazyInstance<base::FilePath>
+ g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER;
// Gets the path for internal plugins.
bool GetInternalPluginsDirectory(base::FilePath* result) {
@@ -116,6 +116,10 @@ bool GetInternalPluginsDirectory(base::FilePath* result) {
return PathService::Get(base::DIR_MODULE, result);
}
+} // namespace
+
+namespace chrome {
+
bool PathProvider(int key, base::FilePath* result) {
// Some keys are just aliases...
switch (key) {
@@ -565,4 +569,12 @@ void RegisterPathProvider() {
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
+void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
+ g_invalid_specified_user_data_dir.Get() = user_data_dir;
+}
+
+const base::FilePath& GetInvalidSpecifiedUserDataDir() {
+ return g_invalid_specified_user_data_dir.Get();
+}
+
} // namespace chrome