Index: chrome/browser/google/google_update.cc |
=================================================================== |
--- chrome/browser/google/google_update.cc (revision 89207) |
+++ chrome/browser/google/google_update.cc (working copy) |
@@ -13,11 +13,10 @@ |
#include "base/string_util.h" |
#include "base/task.h" |
#include "base/threading/thread.h" |
-#include "base/win/registry.h" |
#include "base/win/scoped_comptr.h" |
#include "base/win/windows_version.h" |
#include "chrome/installer/util/browser_distribution.h" |
-#include "chrome/installer/util/google_update_constants.h" |
+#include "chrome/installer/util/google_update_settings.h" |
#include "chrome/installer/util/helper.h" |
#include "chrome/installer/util/install_util.h" |
#include "content/browser/browser_thread.h" |
@@ -26,35 +25,9 @@ |
namespace { |
-// The registry location of the Google Update policies. |
-const wchar_t kGUPolicyRegistrySubKey[] = |
- L"SOFTWARE\\Policies\\Google\\Update"; |
-const wchar_t kGUPolicyGlobalValue[] = L"UpdateDefault"; |
-const wchar_t kGUPolicyAppValuePrefix[] = L"Update"; |
-const DWORD kGUPolicyUpdatesDisabled = 0; |
- |
-// Checks if the updates have been disabled by policy. |
-bool IsUpdateDisabledByPolicy(const std::wstring& guid) { |
-#if !defined(GOOGLE_CHROME_BUILD) |
- return true; |
-#else |
- std::wstring value_name(kGUPolicyAppValuePrefix); |
- value_name.append(guid); |
- DWORD value = 0; |
- base::win::RegKey policy(HKEY_LOCAL_MACHINE, |
- kGUPolicyRegistrySubKey, KEY_READ); |
- // Per application settings override global setting. |
- if ((policy.ReadValueDW(value_name.c_str(), &value) == ERROR_SUCCESS) || |
- (policy.ReadValueDW(kGUPolicyGlobalValue, &value) == ERROR_SUCCESS)) { |
- return value == kGUPolicyUpdatesDisabled; |
- } |
- return false; |
-#endif // defined(GOOGLE_CHROME_BUILD) |
-} |
- |
// Check if the currently running instance can be updated by Google Update. |
-// Returns true only if the instance running is a Google Chrome |
-// distribution installed in a standard location. |
+// Returns GOOGLE_UPDATE_NO_ERROR only if the instance running is a Google |
+// Chrome distribution installed in a standard location. |
GoogleUpdateErrorCode CanUpdateCurrentChrome( |
const std::wstring& chrome_exe_path) { |
#if !defined(GOOGLE_CHROME_BUILD) |
@@ -84,7 +57,8 @@ |
!InstallUtil::IsPerUserInstall(chrome_exe_path.c_str())); |
DCHECK(!app_guid.empty()); |
- if (IsUpdateDisabledByPolicy(app_guid)) |
+ if (GoogleUpdateSettings::GetAppUpdatePolicy(app_guid, NULL) == |
+ GoogleUpdateSettings::UPDATES_DISABLED) |
return GOOGLE_UPDATE_DISABLED_BY_POLICY; |
return GOOGLE_UPDATE_NO_ERROR; |