| 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 #include "chrome/browser/chromeos/login/version_info_updater.h" | 5 #include "chrome/browser/chromeos/login/version_info_updater.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void VersionInfoUpdater::StartUpdate(bool is_official_build) { | 54 void VersionInfoUpdater::StartUpdate(bool is_official_build) { |
| 55 if (base::chromeos::IsRunningOnChromeOS()) { | 55 if (base::chromeos::IsRunningOnChromeOS()) { |
| 56 version_loader_.GetVersion( | 56 version_loader_.GetVersion( |
| 57 is_official_build ? VersionLoader::VERSION_SHORT_WITH_DATE | 57 is_official_build ? VersionLoader::VERSION_SHORT_WITH_DATE |
| 58 : VersionLoader::VERSION_FULL, | 58 : VersionLoader::VERSION_FULL, |
| 59 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), | 59 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), |
| 60 &tracker_); | 60 &tracker_); |
| 61 boot_times_loader_.GetBootTimes( | 61 boot_times_loader_.GetBootTimes( |
| 62 &boot_times_consumer_, | 62 base::Bind(is_official_build ? &VersionInfoUpdater::OnBootTimesNoop |
| 63 base::Bind(is_official_build ? &VersionInfoUpdater::OnBootTimesNoop : | 63 : &VersionInfoUpdater::OnBootTimes, |
| 64 &VersionInfoUpdater::OnBootTimes, | 64 base::Unretained(this)), |
| 65 base::Unretained(this))); | 65 &tracker_); |
| 66 } else { | 66 } else { |
| 67 UpdateVersionLabel(); | 67 UpdateVersionLabel(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 policy::CloudPolicySubsystem* cloud_policy = | 70 policy::CloudPolicySubsystem* cloud_policy = |
| 71 g_browser_process->browser_policy_connector()-> | 71 g_browser_process->browser_policy_connector()-> |
| 72 device_cloud_policy_subsystem(); | 72 device_cloud_policy_subsystem(); |
| 73 if (cloud_policy) { | 73 if (cloud_policy) { |
| 74 // Two-step reset because we want to construct new ObserverRegistrar after | 74 // Two-step reset because we want to construct new ObserverRegistrar after |
| 75 // destruction of old ObserverRegistrar to avoid DCHECK violation because | 75 // destruction of old ObserverRegistrar to avoid DCHECK violation because |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 void VersionInfoUpdater::OnVersion(const std::string& version) { | 192 void VersionInfoUpdater::OnVersion(const std::string& version) { |
| 193 version_text_ = version; | 193 version_text_ = version; |
| 194 UpdateVersionLabel(); | 194 UpdateVersionLabel(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void VersionInfoUpdater::OnBootTimesNoop( | 197 void VersionInfoUpdater::OnBootTimesNoop( |
| 198 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { | 198 const BootTimesLoader::BootTimes& boot_times) {} |
| 199 } | |
| 200 | 199 |
| 201 void VersionInfoUpdater::OnBootTimes( | 200 void VersionInfoUpdater::OnBootTimes( |
| 202 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { | 201 const BootTimesLoader::BootTimes& boot_times) { |
| 203 const char* kBootTimesNoChromeExec = | 202 const char* kBootTimesNoChromeExec = |
| 204 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)"; | 203 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)"; |
| 205 const char* kBootTimesChromeExec = | 204 const char* kBootTimesChromeExec = |
| 206 "Non-firmware boot took %.2f seconds " | 205 "Non-firmware boot took %.2f seconds " |
| 207 "(kernel %.2fs, system %.2fs, chrome %.2fs)"; | 206 "(kernel %.2fs, system %.2fs, chrome %.2fs)"; |
| 208 std::string boot_times_text; | 207 std::string boot_times_text; |
| 209 | 208 |
| 210 if (boot_times.chrome > 0) { | 209 if (boot_times.chrome > 0) { |
| 211 boot_times_text = | 210 boot_times_text = |
| 212 base::StringPrintf( | 211 base::StringPrintf( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 238 int type, | 237 int type, |
| 239 const content::NotificationSource& source, | 238 const content::NotificationSource& source, |
| 240 const content::NotificationDetails& details) { | 239 const content::NotificationDetails& details) { |
| 241 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED) | 240 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED) |
| 242 UpdateEnterpriseInfo(); | 241 UpdateEnterpriseInfo(); |
| 243 else | 242 else |
| 244 NOTREACHED(); | 243 NOTREACHED(); |
| 245 } | 244 } |
| 246 | 245 |
| 247 } // namespace chromeos | 246 } // namespace chromeos |
| OLD | NEW |