Index: chrome/installer/util/google_update_settings.cc |
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc |
index e32e185d354c26607c7908f55f5c52ebb02a78c3..1708bb45d359c388b8d99ad364babacfb67205db 100644 |
--- a/chrome/installer/util/google_update_settings.cc |
+++ b/chrome/installer/util/google_update_settings.cc |
@@ -8,6 +8,7 @@ |
#include <algorithm> |
#include <limits> |
+#include <vector> |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
@@ -36,6 +37,10 @@ using installer::InstallationState; |
const wchar_t GoogleUpdateSettings::kPoliciesKey[] = |
L"SOFTWARE\\Policies\\Google\\Update"; |
const wchar_t GoogleUpdateSettings::kUpdatePolicyValue[] = L"UpdateDefault"; |
+const wchar_t GoogleUpdateSettings::kDownloadPreference[] = |
+ L"DownloadPreference"; |
+const wchar_t GoogleUpdateSettings::kDownloadPreferenceCacheable[] = |
+ L"cacheable"; |
const wchar_t GoogleUpdateSettings::kUpdateOverrideValuePrefix[] = L"Update"; |
const wchar_t GoogleUpdateSettings::kCheckPeriodOverrideMinutes[] = |
L"AutoUpdateCheckPeriodMinutes"; |
@@ -770,6 +775,21 @@ bool GoogleUpdateSettings::ReenableAutoupdates() { |
return true; |
} |
+// Reads and sanitizes the value of |
+// "HKLM\SOFTWARE\Policies\Google\Update\DownloadPreference". The current |
+// implementation supports only "cacheable" as a valid policy option. |
waffles
2016/01/21 01:56:08
Do we want to consider an alternate sanitization p
Sorin Jianu
2016/01/21 02:53:55
I've sanitized by hand since adding a dependency o
|
+base::string16 GoogleUpdateSettings::GetDownloadPreference() { |
+ RegKey policy_key; |
+ base::string16 value; |
+ if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) == |
+ ERROR_SUCCESS && |
+ policy_key.ReadValue(kDownloadPreference, &value) == ERROR_SUCCESS && |
+ value == GoogleUpdateSettings::kDownloadPreferenceCacheable) { |
+ return value; |
+ } |
+ return base::string16(); |
+} |
+ |
void GoogleUpdateSettings::RecordChromeUpdatePolicyHistograms() { |
const bool is_multi_install = InstallUtil::IsMultiInstall( |
BrowserDistribution::GetDistribution(), IsSystemInstall()); |