| 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_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/boot_times_loader.h" | 10 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 11 #include "chrome/browser/chromeos/version_loader.h" | 11 #include "chrome/browser/chromeos/version_loader.h" |
| 12 #include "chrome/browser/policy/cloud_policy_store.h" | 12 #include "chrome/browser/policy/cloud_policy_store.h" |
| 13 #include "chrome/browser/policy/cloud_policy_subsystem.h" | |
| 14 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 15 | 14 |
| 16 namespace chromeos { | 15 namespace chromeos { |
| 17 | 16 |
| 18 class CrosSettings; | 17 class CrosSettings; |
| 19 | 18 |
| 20 // Fetches all info we want to show on OOBE/Login screens about system | 19 // Fetches all info we want to show on OOBE/Login screens about system |
| 21 // version, boot times and cloud policy. | 20 // version, boot times and cloud policy. |
| 22 class VersionInfoUpdater : public policy::CloudPolicySubsystem::Observer, | 21 class VersionInfoUpdater : public policy::CloudPolicyStore::Observer, |
| 23 public policy::CloudPolicyStore::Observer, | |
| 24 public content::NotificationObserver { | 22 public content::NotificationObserver { |
| 25 public: | 23 public: |
| 26 class Delegate { | 24 class Delegate { |
| 27 public: | 25 public: |
| 28 virtual ~Delegate() {} | 26 virtual ~Delegate() {} |
| 29 | 27 |
| 30 // Called when OS version label should be updated. | 28 // Called when OS version label should be updated. |
| 31 virtual void OnOSVersionLabelTextUpdated( | 29 virtual void OnOSVersionLabelTextUpdated( |
| 32 const std::string& os_version_label_text) = 0; | 30 const std::string& os_version_label_text) = 0; |
| 33 | 31 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 virtual ~VersionInfoUpdater(); | 42 virtual ~VersionInfoUpdater(); |
| 45 | 43 |
| 46 // Sets delegate. | 44 // Sets delegate. |
| 47 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 45 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 48 | 46 |
| 49 // Starts fetching version info. The delegate will be notified when update | 47 // Starts fetching version info. The delegate will be notified when update |
| 50 // is received. | 48 // is received. |
| 51 void StartUpdate(bool is_official_build); | 49 void StartUpdate(bool is_official_build); |
| 52 | 50 |
| 53 private: | 51 private: |
| 54 // policy::CloudPolicySubsystem::Observer methods: | |
| 55 virtual void OnPolicyStateChanged( | |
| 56 policy::CloudPolicySubsystem::PolicySubsystemState state, | |
| 57 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; | |
| 58 | |
| 59 // policy::CloudPolicyStore::Observer interface: | 52 // policy::CloudPolicyStore::Observer interface: |
| 60 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE; | 53 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE; |
| 61 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE; | 54 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE; |
| 62 | 55 |
| 63 // content::NotificationObserver interface. | 56 // content::NotificationObserver interface. |
| 64 virtual void Observe( | 57 virtual void Observe( |
| 65 int type, | 58 int type, |
| 66 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
| 67 const content::NotificationDetails& details) OVERRIDE; | 60 const content::NotificationDetails& details) OVERRIDE; |
| 68 | 61 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 89 // Used to request version and boot times. | 82 // Used to request version and boot times. |
| 90 CancelableTaskTracker tracker_; | 83 CancelableTaskTracker tracker_; |
| 91 | 84 |
| 92 // Information pieces for version label. | 85 // Information pieces for version label. |
| 93 std::string version_text_; | 86 std::string version_text_; |
| 94 std::string enterprise_domain_text_; | 87 std::string enterprise_domain_text_; |
| 95 | 88 |
| 96 // Full text for the OS version label. | 89 // Full text for the OS version label. |
| 97 std::string os_version_label_text_; | 90 std::string os_version_label_text_; |
| 98 | 91 |
| 99 // CloudPolicySubsysterm observer registrar | |
| 100 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> | |
| 101 cloud_policy_registrar_; | |
| 102 | |
| 103 chromeos::CrosSettings* cros_settings_; | 92 chromeos::CrosSettings* cros_settings_; |
| 104 | 93 |
| 105 Delegate* delegate_; | 94 Delegate* delegate_; |
| 106 | 95 |
| 107 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); | 96 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); |
| 108 }; | 97 }; |
| 109 | 98 |
| 110 } // namespace chromeos | 99 } // namespace chromeos |
| 111 | 100 |
| 112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| OLD | NEW |