| 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 "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/chromeos/boot_times_loader.h" | 11 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 12 #include "chrome/browser/chromeos/version_loader.h" | 12 #include "chrome/browser/chromeos/version_loader.h" |
| 13 #include "chrome/browser/policy/cloud_policy_store.h" | 13 #include "chrome/browser/policy/cloud_policy_store.h" |
| 14 #include "chrome/browser/policy/cloud_policy_subsystem.h" | |
| 15 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 16 | 15 |
| 17 namespace chromeos { | 16 namespace chromeos { |
| 18 | 17 |
| 19 class CrosSettings; | 18 class CrosSettings; |
| 20 | 19 |
| 21 // Fetches all info we want to show on OOBE/Login screens about system | 20 // Fetches all info we want to show on OOBE/Login screens about system |
| 22 // version, boot times and cloud policy. | 21 // version, boot times and cloud policy. |
| 23 class VersionInfoUpdater : public policy::CloudPolicySubsystem::Observer, | 22 class VersionInfoUpdater : public policy::CloudPolicyStore::Observer, |
| 24 public policy::CloudPolicyStore::Observer, | |
| 25 public content::NotificationObserver { | 23 public content::NotificationObserver { |
| 26 public: | 24 public: |
| 27 class Delegate { | 25 class Delegate { |
| 28 public: | 26 public: |
| 29 virtual ~Delegate() {} | 27 virtual ~Delegate() {} |
| 30 | 28 |
| 31 // Called when OS version label should be updated. | 29 // Called when OS version label should be updated. |
| 32 virtual void OnOSVersionLabelTextUpdated( | 30 virtual void OnOSVersionLabelTextUpdated( |
| 33 const std::string& os_version_label_text) = 0; | 31 const std::string& os_version_label_text) = 0; |
| 34 | 32 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 virtual ~VersionInfoUpdater(); | 43 virtual ~VersionInfoUpdater(); |
| 46 | 44 |
| 47 // Sets delegate. | 45 // Sets delegate. |
| 48 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 46 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 49 | 47 |
| 50 // Starts fetching version info. The delegate will be notified when update | 48 // Starts fetching version info. The delegate will be notified when update |
| 51 // is received. | 49 // is received. |
| 52 void StartUpdate(bool is_official_build); | 50 void StartUpdate(bool is_official_build); |
| 53 | 51 |
| 54 private: | 52 private: |
| 55 // policy::CloudPolicySubsystem::Observer methods: | |
| 56 virtual void OnPolicyStateChanged( | |
| 57 policy::CloudPolicySubsystem::PolicySubsystemState state, | |
| 58 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; | |
| 59 | |
| 60 // policy::CloudPolicyStore::Observer interface: | 53 // policy::CloudPolicyStore::Observer interface: |
| 61 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE; | 54 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE; |
| 62 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE; | 55 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE; |
| 63 | 56 |
| 64 // content::NotificationObserver interface. | 57 // content::NotificationObserver interface. |
| 65 virtual void Observe( | 58 virtual void Observe( |
| 66 int type, | 59 int type, |
| 67 const content::NotificationSource& source, | 60 const content::NotificationSource& source, |
| 68 const content::NotificationDetails& details) OVERRIDE; | 61 const content::NotificationDetails& details) OVERRIDE; |
| 69 | 62 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 85 | 78 |
| 86 // Handles asynchronously loading the version. | 79 // Handles asynchronously loading the version. |
| 87 VersionLoader version_loader_; | 80 VersionLoader version_loader_; |
| 88 // Handles asynchronously loading the boot times. | 81 // Handles asynchronously loading the boot times. |
| 89 BootTimesLoader boot_times_loader_; | 82 BootTimesLoader boot_times_loader_; |
| 90 // Used to request version and boot times. | 83 // Used to request version and boot times. |
| 91 CancelableTaskTracker tracker_; | 84 CancelableTaskTracker tracker_; |
| 92 | 85 |
| 93 // Information pieces for version label. | 86 // Information pieces for version label. |
| 94 std::string version_text_; | 87 std::string version_text_; |
| 95 std::string enterprise_domain_text_; | |
| 96 | 88 |
| 97 // Full text for the OS version label. | 89 // Full text for the OS version label. |
| 98 std::string os_version_label_text_; | 90 std::string os_version_label_text_; |
| 99 | 91 |
| 100 // CloudPolicySubsysterm observer registrar | |
| 101 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> | |
| 102 cloud_policy_registrar_; | |
| 103 | |
| 104 chromeos::CrosSettings* cros_settings_; | 92 chromeos::CrosSettings* cros_settings_; |
| 105 | 93 |
| 106 Delegate* delegate_; | 94 Delegate* delegate_; |
| 107 | 95 |
| 108 // Weak pointer factory so we can give our callbacks for invocation | 96 // Weak pointer factory so we can give our callbacks for invocation |
| 109 // at a later time without worrying that they will actually try to | 97 // at a later time without worrying that they will actually try to |
| 110 // happen after the lifetime of this object. | 98 // happen after the lifetime of this object. |
| 111 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_; | 99 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_; |
| 112 | 100 |
| 113 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); | 101 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); |
| 114 }; | 102 }; |
| 115 | 103 |
| 116 } // namespace chromeos | 104 } // namespace chromeos |
| 117 | 105 |
| 118 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ | 106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| OLD | NEW |