OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 12 #include "chrome/browser/chromeos/version_loader.h" |
| 13 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 // Fetches all info we want to show on OOBE/Login screens about system |
| 18 // version, boot times and cloud policy. |
| 19 class VersionInfoUpdater : policy::CloudPolicySubsystem::Observer { |
| 20 public: |
| 21 class Delegate { |
| 22 public: |
| 23 virtual ~Delegate() {} |
| 24 |
| 25 // Called when OS version label should be updated. |
| 26 virtual void OnOSVersionLabelTextUpdated( |
| 27 const std::string& os_version_label_text) = 0; |
| 28 |
| 29 // Called when boot times label should be updated. |
| 30 virtual void OnBootTimesLabelTextUpdated( |
| 31 const std::string& boot_times_label_text) = 0; |
| 32 }; |
| 33 |
| 34 explicit VersionInfoUpdater(Delegate* delegate); |
| 35 virtual ~VersionInfoUpdater(); |
| 36 |
| 37 // Sets delegate. |
| 38 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 39 |
| 40 // Starts fetching version info. The delegate will be notified when update |
| 41 // is received. |
| 42 void StartUpdate(bool is_official_build); |
| 43 |
| 44 private: |
| 45 // policy::CloudPolicySubsystem::Observer methods: |
| 46 virtual void OnPolicyStateChanged( |
| 47 policy::CloudPolicySubsystem::PolicySubsystemState state, |
| 48 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; |
| 49 |
| 50 // Update the version label. |
| 51 void UpdateVersionLabel(); |
| 52 |
| 53 // Check and update enterprise domain. |
| 54 void UpdateEnterpriseInfo(); |
| 55 |
| 56 // Set enterprise domain name. |
| 57 void SetEnterpriseInfo(const std::string& domain_name, |
| 58 const std::string& status_text); |
| 59 |
| 60 // Callback from chromeos::VersionLoader giving the version. |
| 61 void OnVersion(VersionLoader::Handle handle, std::string version); |
| 62 // Callback from chromeos::InfoLoader giving the boot times. |
| 63 void OnBootTimes( |
| 64 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times); |
| 65 |
| 66 // Handles asynchronously loading the version. |
| 67 VersionLoader version_loader_; |
| 68 // Used to request the version. |
| 69 CancelableRequestConsumer version_consumer_; |
| 70 |
| 71 // Handles asynchronously loading the boot times. |
| 72 BootTimesLoader boot_times_loader_; |
| 73 // Used to request the boot times. |
| 74 CancelableRequestConsumer boot_times_consumer_; |
| 75 |
| 76 // Information pieces for version label. |
| 77 std::string version_text_; |
| 78 std::string enterprise_domain_text_; |
| 79 std::string enterprise_status_text_; |
| 80 |
| 81 // Full text for the OS version label. |
| 82 std::string os_version_label_text_; |
| 83 |
| 84 // CloudPolicySubsysterm observer registrar |
| 85 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> |
| 86 cloud_policy_registrar_; |
| 87 |
| 88 Delegate* delegate_; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); |
| 91 }; |
| 92 |
| 93 } // namespace chromeos |
| 94 |
| 95 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
| 96 |
OLD | NEW |