OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/chromeos/login/version_info_updater.h" | 5 #include "chrome/browser/chromeos/login/version_info_updater.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 } | 43 } |
44 | 44 |
45 void VersionInfoUpdater::StartUpdate(bool is_official_build) { | 45 void VersionInfoUpdater::StartUpdate(bool is_official_build) { |
46 if (CrosLibrary::Get()->EnsureLoaded()) { | 46 if (CrosLibrary::Get()->EnsureLoaded()) { |
47 version_loader_.GetVersion( | 47 version_loader_.GetVersion( |
48 &version_consumer_, | 48 &version_consumer_, |
49 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), | 49 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), |
50 is_official_build ? | 50 is_official_build ? |
51 VersionLoader::VERSION_SHORT_WITH_DATE : | 51 VersionLoader::VERSION_SHORT_WITH_DATE : |
52 VersionLoader::VERSION_FULL); | 52 VersionLoader::VERSION_FULL); |
53 if (!is_official_build) { | 53 boot_times_loader_.GetBootTimes( |
54 boot_times_loader_.GetBootTimes( | 54 &boot_times_consumer_, |
55 &boot_times_consumer_, | 55 NewCallback(this, is_official_build ? |
56 NewCallback(this, &VersionInfoUpdater::OnBootTimes)); | 56 &VersionInfoUpdater::OnBootTimesNoop : |
57 } | 57 &VersionInfoUpdater::OnBootTimes)); |
jrbarnette
2011/11/09 23:54:03
It would help to have a comment here mentioning th
| |
58 } else { | 58 } else { |
59 UpdateVersionLabel(); | 59 UpdateVersionLabel(); |
60 } | 60 } |
61 | 61 |
62 policy::CloudPolicySubsystem* cloud_policy = | 62 policy::CloudPolicySubsystem* cloud_policy = |
63 g_browser_process->browser_policy_connector()-> | 63 g_browser_process->browser_policy_connector()-> |
64 device_cloud_policy_subsystem(); | 64 device_cloud_policy_subsystem(); |
65 if (cloud_policy) { | 65 if (cloud_policy) { |
66 // Two-step reset because we want to construct new ObserverRegistrar after | 66 // Two-step reset because we want to construct new ObserverRegistrar after |
67 // destruction of old ObserverRegistrar to avoid DCHECK violation because | 67 // destruction of old ObserverRegistrar to avoid DCHECK violation because |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 UpdateVersionLabel(); | 159 UpdateVersionLabel(); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 void VersionInfoUpdater::OnVersion( | 163 void VersionInfoUpdater::OnVersion( |
164 VersionLoader::Handle handle, std::string version) { | 164 VersionLoader::Handle handle, std::string version) { |
165 version_text_.swap(version); | 165 version_text_.swap(version); |
166 UpdateVersionLabel(); | 166 UpdateVersionLabel(); |
167 } | 167 } |
168 | 168 |
169 void VersionInfoUpdater::OnBootTimesNoop( | |
170 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { | |
171 } | |
172 | |
169 void VersionInfoUpdater::OnBootTimes( | 173 void VersionInfoUpdater::OnBootTimes( |
170 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { | 174 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { |
171 const char* kBootTimesNoChromeExec = | 175 const char* kBootTimesNoChromeExec = |
172 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)"; | 176 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)"; |
173 const char* kBootTimesChromeExec = | 177 const char* kBootTimesChromeExec = |
174 "Non-firmware boot took %.2f seconds " | 178 "Non-firmware boot took %.2f seconds " |
175 "(kernel %.2fs, system %.2fs, chrome %.2fs)"; | 179 "(kernel %.2fs, system %.2fs, chrome %.2fs)"; |
176 std::string boot_times_text; | 180 std::string boot_times_text; |
177 | 181 |
178 if (boot_times.chrome > 0) { | 182 if (boot_times.chrome > 0) { |
(...skipping 17 matching lines...) Expand all Loading... | |
196 delegate_->OnBootTimesLabelTextUpdated(boot_times_text); | 200 delegate_->OnBootTimesLabelTextUpdated(boot_times_text); |
197 } | 201 } |
198 | 202 |
199 void VersionInfoUpdater::OnPolicyStateChanged( | 203 void VersionInfoUpdater::OnPolicyStateChanged( |
200 policy::CloudPolicySubsystem::PolicySubsystemState state, | 204 policy::CloudPolicySubsystem::PolicySubsystemState state, |
201 policy::CloudPolicySubsystem::ErrorDetails error_details) { | 205 policy::CloudPolicySubsystem::ErrorDetails error_details) { |
202 UpdateEnterpriseInfo(); | 206 UpdateEnterpriseInfo(); |
203 } | 207 } |
204 | 208 |
205 } // namespace chromeos | 209 } // namespace chromeos |
OLD | NEW |