| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
| 6 #define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 6 #define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/version.h" | 16 #include "base/version.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/installer/util/util_constants.h" | 18 #include "chrome/installer/util/util_constants.h" |
| 19 #include "components/metrics/client_info.h" | 19 #include "components/metrics/client_info.h" |
| 20 | 20 |
| 21 class AppRegistrationData; | 21 class AppRegistrationData; |
| 22 class BrowserDistribution; | 22 class BrowserDistribution; |
| 23 | 23 |
| 24 namespace installer { | 24 namespace installer { |
| 25 class ChannelInfo; | 25 class ChannelInfo; |
| 26 class InstallationState; | 26 class InstallationState; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // This class provides accessors to the Google Update 'ClientState' information | 29 // This class provides accessors to the Google Update group policies and |
| 30 // that recorded when the user downloads the chrome installer. It is | 30 // 'ClientState' information. The group policies are set using specific |
| 31 // google_update.exe responsibility to write the initial values. | 31 // administrative templates. The 'ClientState' information is recorded when the |
| 32 // user downloads the Chrome installer. It is google_update.exe responsibility |
| 33 // to write the initial values. |
| 32 class GoogleUpdateSettings { | 34 class GoogleUpdateSettings { |
| 33 public: | 35 public: |
| 34 // Update policy constants defined by Google Update; do not change these. | 36 // Update policy constants defined by Google Update; do not change these. |
| 35 enum UpdatePolicy { | 37 enum UpdatePolicy { |
| 36 UPDATES_DISABLED = 0, | 38 UPDATES_DISABLED = 0, |
| 37 AUTOMATIC_UPDATES = 1, | 39 AUTOMATIC_UPDATES = 1, |
| 38 MANUAL_UPDATES_ONLY = 2, | 40 MANUAL_UPDATES_ONLY = 2, |
| 39 AUTO_UPDATES_ONLY = 3, | 41 AUTO_UPDATES_ONLY = 3, |
| 40 UPDATE_POLICIES_COUNT | 42 UPDATE_POLICIES_COUNT |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 static const wchar_t kPoliciesKey[]; | 45 static const wchar_t kPoliciesKey[]; |
| 44 static const wchar_t kUpdatePolicyValue[]; | 46 static const wchar_t kUpdatePolicyValue[]; |
| 45 static const wchar_t kUpdateOverrideValuePrefix[]; | 47 static const wchar_t kUpdateOverrideValuePrefix[]; |
| 46 static const wchar_t kCheckPeriodOverrideMinutes[]; | 48 static const wchar_t kCheckPeriodOverrideMinutes[]; |
| 49 static const wchar_t kDownloadPreference[]; |
| 50 static const wchar_t kDownloadPreferenceCacheable[]; |
| 47 static const int kCheckPeriodOverrideMinutesDefault; | 51 static const int kCheckPeriodOverrideMinutesDefault; |
| 48 static const int kCheckPeriodOverrideMinutesMax; | 52 static const int kCheckPeriodOverrideMinutesMax; |
| 49 static const GoogleUpdateSettings::UpdatePolicy kDefaultUpdatePolicy; | 53 static const GoogleUpdateSettings::UpdatePolicy kDefaultUpdatePolicy; |
| 50 | 54 |
| 51 // Defines product data that is tracked/used by Google Update. | 55 // Defines product data that is tracked/used by Google Update. |
| 52 struct ProductData { | 56 struct ProductData { |
| 53 // The currently installed version. | 57 // The currently installed version. |
| 54 std::string version; | 58 std::string version; |
| 55 // The time that Google Update last updated this product. (This means | 59 // The time that Google Update last updated this product. (This means |
| 56 // either running an updater successfully, or doing an update check that | 60 // either running an updater successfully, or doing an update check that |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // settings that would block updates from occurring. This is a superset of the | 263 // settings that would block updates from occurring. This is a superset of the |
| 260 // things checked by GetAppUpdatePolicy() as GetAppUpdatePolicy() does not | 264 // things checked by GetAppUpdatePolicy() as GetAppUpdatePolicy() does not |
| 261 // check Omaha's AutoUpdateCheckPeriodMinutes setting which will be reset by | 265 // check Omaha's AutoUpdateCheckPeriodMinutes setting which will be reset by |
| 262 // this method. Will need to be called from an elevated process since those | 266 // this method. Will need to be called from an elevated process since those |
| 263 // settings live in HKLM. Returns true if there is a reasonable belief that | 267 // settings live in HKLM. Returns true if there is a reasonable belief that |
| 264 // updates are not disabled by policy when this method returns, false | 268 // updates are not disabled by policy when this method returns, false |
| 265 // otherwise. Note that for Chromium builds, this returns true since Chromium | 269 // otherwise. Note that for Chromium builds, this returns true since Chromium |
| 266 // is assumed not to autoupdate. | 270 // is assumed not to autoupdate. |
| 267 static bool ReenableAutoupdates(); | 271 static bool ReenableAutoupdates(); |
| 268 | 272 |
| 273 // Returns "cacheable" if the Google Update group policy to prefer |
| 274 // cacheable payloads is set. Returns an empty string if no policy or |
| 275 // an unrecognized group policy is set. |
| 276 static base::string16 GetDownloadPreference(); |
| 277 |
| 269 // Records UMA stats about Chrome's update policy. | 278 // Records UMA stats about Chrome's update policy. |
| 270 static void RecordChromeUpdatePolicyHistograms(); | 279 static void RecordChromeUpdatePolicyHistograms(); |
| 271 | 280 |
| 272 // Returns Google Update's uninstall command line, or an empty string if none | 281 // Returns Google Update's uninstall command line, or an empty string if none |
| 273 // is found. | 282 // is found. |
| 274 static base::string16 GetUninstallCommandLine(bool system_install); | 283 static base::string16 GetUninstallCommandLine(bool system_install); |
| 275 | 284 |
| 276 // Returns the version of Google Update that is installed. | 285 // Returns the version of Google Update that is installed. |
| 277 static Version GetGoogleUpdateVersion(bool system_install); | 286 static Version GetGoogleUpdateVersion(bool system_install); |
| 278 | 287 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // this will do nothing to |experiment_labels|. This will return true if the | 326 // this will do nothing to |experiment_labels|. This will return true if the |
| 318 // label did not exist, or was successfully read. | 327 // label did not exist, or was successfully read. |
| 319 static bool ReadExperimentLabels(bool system_install, | 328 static bool ReadExperimentLabels(bool system_install, |
| 320 base::string16* experiment_labels); | 329 base::string16* experiment_labels); |
| 321 | 330 |
| 322 private: | 331 private: |
| 323 DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings); | 332 DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings); |
| 324 }; | 333 }; |
| 325 | 334 |
| 326 #endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 335 #endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
| OLD | NEW |