| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_COMPONENT_UPDATER_UPDATER_STATE_WIN_H_ | |
| 6 #define COMPONENTS_COMPONENT_UPDATER_UPDATER_STATE_WIN_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "base/time/time.h" | |
| 13 #include "base/version.h" | |
| 14 #include "components/update_client/update_client.h" | |
| 15 | |
| 16 namespace component_updater { | |
| 17 | |
| 18 // TODO(sorin): implement this in terms of | |
| 19 // chrome/installer/util/google_update_settings (crbug.com/615187). | |
| 20 class UpdaterState { | |
| 21 public: | |
| 22 static std::unique_ptr<UpdaterState> Create(bool is_machine); | |
| 23 | |
| 24 update_client::InstallerAttributes MakeInstallerAttributes() const; | |
| 25 | |
| 26 private: | |
| 27 FRIEND_TEST_ALL_PREFIXES(UpdaterStateTest, MakeInstallerAttributes); | |
| 28 | |
| 29 explicit UpdaterState(bool is_machine); | |
| 30 | |
| 31 // This function is best-effort. It updates the class members with | |
| 32 // the relevant values that could be retrieved. | |
| 33 void ReadState(); | |
| 34 | |
| 35 static base::Version GetGoogleUpdateVersion(bool is_machine); | |
| 36 static bool IsAutoupdateCheckEnabled(); | |
| 37 static bool IsJoinedToDomain(); | |
| 38 static base::Time GetGoogleUpdateLastStartedAU(bool is_machine); | |
| 39 static base::Time GetGoogleUpdateLastChecked(bool is_machine); | |
| 40 static base::Time GetGoogleUpdateTimeValue(bool is_machine, | |
| 41 const wchar_t* value_name); | |
| 42 static int GetChromeUpdatePolicy(); | |
| 43 | |
| 44 static std::string NormalizeTimeDelta(const base::TimeDelta& delta); | |
| 45 | |
| 46 bool is_machine_; | |
| 47 base::Version google_update_version_; | |
| 48 base::Time last_autoupdate_started_; | |
| 49 base::Time last_checked_; | |
| 50 bool is_joined_to_domain_ = false; | |
| 51 bool is_autoupdate_check_enabled_ = false; | |
| 52 int chrome_update_policy_ = 0; | |
| 53 }; | |
| 54 | |
| 55 } // namespace component_updater | |
| 56 | |
| 57 #endif // COMPONENTS_COMPONENT_UPDATER_UPDATER_STATE_WIN_H_ | |
| OLD | NEW |