Index: chrome/common/chrome_paths.cc |
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc |
index 2333da1fd2489182bccbddf3f90b2d042d9b2699..a355b0e0bd14b0dc8c342af5ee7f5d7b84c477bc 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,10 @@ const base::FilePath::CharType kFilepathSinglePrefExtensions[] = |
#endif // defined(GOOGLE_CHROME_BUILD) |
#endif // defined(OS_LINUX) |
-} // namespace |
+static bool g_user_data_dir_initialized = false; |
-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 +118,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) { |
@@ -155,6 +161,7 @@ bool PathProvider(int key, base::FilePath* result) { |
base::FilePath cur; |
switch (key) { |
case chrome::DIR_USER_DATA: |
+ CHECK(g_user_data_dir_initialized); |
Vitaly Buka (NO REVIEWS)
2014/02/22 00:27:09
DCHECK is safer here. We need to merge this patch
msw
2014/02/22 00:42:07
Done.
|
if (!GetDefaultUserDataDirectory(&cur)) { |
NOTREACHED(); |
return false; |
@@ -551,4 +558,16 @@ void RegisterPathProvider() { |
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
} |
+void SetUserDataDirInitialized() { |
+ g_user_data_dir_initialized = true; |
+} |
+ |
+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 |