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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 public content::NotificationObserver { | 23 public content::NotificationObserver { |
24 public: | 24 public: |
25 class Delegate { | 25 class Delegate { |
26 public: | 26 public: |
27 virtual ~Delegate() {} | 27 virtual ~Delegate() {} |
28 | 28 |
29 // Called when OS version label should be updated. | 29 // Called when OS version label should be updated. |
30 virtual void OnOSVersionLabelTextUpdated( | 30 virtual void OnOSVersionLabelTextUpdated( |
31 const std::string& os_version_label_text) = 0; | 31 const std::string& os_version_label_text) = 0; |
32 | 32 |
33 // Called when boot times label should be updated. | |
34 virtual void OnBootTimesLabelTextUpdated( | |
35 const std::string& boot_times_label_text) = 0; | |
36 | |
37 // Called when the enterprise info notice should be updated. | 33 // Called when the enterprise info notice should be updated. |
38 virtual void OnEnterpriseInfoUpdated( | 34 virtual void OnEnterpriseInfoUpdated( |
39 const std::string& enterprise_info) = 0; | 35 const std::string& enterprise_info) = 0; |
40 }; | 36 }; |
41 | 37 |
42 explicit VersionInfoUpdater(Delegate* delegate); | 38 explicit VersionInfoUpdater(Delegate* delegate); |
43 virtual ~VersionInfoUpdater(); | 39 virtual ~VersionInfoUpdater(); |
44 | 40 |
45 // Sets delegate. | 41 // Sets delegate. |
46 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 42 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
(...skipping 17 matching lines...) Expand all Loading... |
64 void UpdateVersionLabel(); | 60 void UpdateVersionLabel(); |
65 | 61 |
66 // Check and update enterprise domain. | 62 // Check and update enterprise domain. |
67 void UpdateEnterpriseInfo(); | 63 void UpdateEnterpriseInfo(); |
68 | 64 |
69 // Set enterprise domain name. | 65 // Set enterprise domain name. |
70 void SetEnterpriseInfo(const std::string& domain_name); | 66 void SetEnterpriseInfo(const std::string& domain_name); |
71 | 67 |
72 // Callback from chromeos::VersionLoader giving the version. | 68 // Callback from chromeos::VersionLoader giving the version. |
73 void OnVersion(const std::string& version); | 69 void OnVersion(const std::string& version); |
74 // Callback from chromeos::InfoLoader giving the boot times. | |
75 void OnBootTimes(const BootTimesLoader::BootTimes& boot_times); | |
76 // Null callback from chromeos::InfoLoader. | |
77 void OnBootTimesNoop(const BootTimesLoader::BootTimes& boot_times); | |
78 | 70 |
79 // Handles asynchronously loading the version. | 71 // Handles asynchronously loading the version. |
80 VersionLoader version_loader_; | 72 VersionLoader version_loader_; |
81 // Handles asynchronously loading the boot times. | 73 // Handles asynchronously loading the boot times. |
82 BootTimesLoader boot_times_loader_; | 74 BootTimesLoader boot_times_loader_; |
83 // Used to request version and boot times. | 75 // Used to request version and boot times. |
84 CancelableTaskTracker tracker_; | 76 CancelableTaskTracker tracker_; |
85 | 77 |
86 // Information pieces for version label. | 78 // Information pieces for version label. |
87 std::string version_text_; | 79 std::string version_text_; |
88 | 80 |
89 // Full text for the OS version label. | 81 // Full text for the OS version label. |
90 std::string os_version_label_text_; | 82 std::string os_version_label_text_; |
91 | 83 |
92 chromeos::CrosSettings* cros_settings_; | 84 chromeos::CrosSettings* cros_settings_; |
93 | 85 |
94 Delegate* delegate_; | 86 Delegate* delegate_; |
95 | 87 |
96 // Weak pointer factory so we can give our callbacks for invocation | 88 // Weak pointer factory so we can give our callbacks for invocation |
97 // at a later time without worrying that they will actually try to | 89 // at a later time without worrying that they will actually try to |
98 // happen after the lifetime of this object. | 90 // happen after the lifetime of this object. |
99 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_; | 91 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_; |
100 | 92 |
101 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); | 93 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); |
102 }; | 94 }; |
103 | 95 |
104 } // namespace chromeos | 96 } // namespace chromeos |
105 | 97 |
106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ | 98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ |
OLD | NEW |