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

Unified Diff: chrome/browser/policy/policy_path_parser_win.cc

Issue 1986823002: Reset user data directory and disk cache directory after downgrade. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « chrome/browser/policy/policy_path_parser_mac.mm ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_path_parser_win.cc
diff --git a/chrome/browser/policy/policy_path_parser_win.cc b/chrome/browser/policy/policy_path_parser_win.cc
index 7ec15f23d76a79660941bd28c84921c58cd0e66a..cf693ff7c9790e026d555e5be34ffdc97e16d5ed 100644
--- a/chrome/browser/policy/policy_path_parser_win.cc
+++ b/chrome/browser/policy/policy_path_parser_win.cc
@@ -19,9 +19,11 @@
namespace {
// Checks if the key exists in the given hive and expands any string variables.
-bool LoadUserDataDirPolicyFromRegistry(HKEY hive, base::FilePath* dir) {
+bool LoadUserDataDirPolicyFromRegistry(HKEY hive,
+ const char* key_name_str,
+ base::FilePath* dir) {
base::string16 value;
- base::string16 key_name(base::ASCIIToUTF16(policy::key::kUserDataDir));
+ base::string16 key_name(base::ASCIIToUTF16(key_name_str));
base::win::RegKey key(hive, policy::kRegistryChromePolicyKey, KEY_READ);
if (key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) {
*dir = base::FilePath(policy::path_parser::ExpandPathVariables(value));
@@ -147,8 +149,20 @@ base::FilePath::StringType ExpandPathVariables(
void CheckUserDataDirPolicy(base::FilePath* user_data_dir) {
DCHECK(user_data_dir);
// Policy from the HKLM hive has precedence over HKCU.
- if (!LoadUserDataDirPolicyFromRegistry(HKEY_LOCAL_MACHINE, user_data_dir))
- LoadUserDataDirPolicyFromRegistry(HKEY_CURRENT_USER, user_data_dir);
+ if (!LoadUserDataDirPolicyFromRegistry(HKEY_LOCAL_MACHINE, key::kUserDataDir,
+ user_data_dir)) {
+ LoadUserDataDirPolicyFromRegistry(HKEY_CURRENT_USER, key::kUserDataDir,
+ user_data_dir);
+ }
+}
+
+void CheckDiskCacheDirPolicy(base::FilePath* disk_cache_dir) {
+ DCHECK(disk_cache_dir);
+ if (!LoadUserDataDirPolicyFromRegistry(HKEY_LOCAL_MACHINE, key::kDiskCacheDir,
+ disk_cache_dir)) {
+ LoadUserDataDirPolicyFromRegistry(HKEY_CURRENT_USER, key::kDiskCacheDir,
+ disk_cache_dir);
+ }
}
} // namespace path_parser
« no previous file with comments | « chrome/browser/policy/policy_path_parser_mac.mm ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698