Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/chromeos/login/version_info_updater.cc

Issue 11410073: Add function to CancelableTaskTracker and convert BootTimeLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: *->& Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 &version_consumer_, 57 &version_consumer_,
58 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)), 58 base::Bind(&VersionInfoUpdater::OnVersion, base::Unretained(this)),
59 is_official_build ? 59 is_official_build ?
60 VersionLoader::VERSION_SHORT_WITH_DATE : 60 VersionLoader::VERSION_SHORT_WITH_DATE :
61 VersionLoader::VERSION_FULL); 61 VersionLoader::VERSION_FULL);
62 boot_times_loader_.GetBootTimes( 62 boot_times_loader_.GetBootTimes(
63 &boot_times_consumer_, 63 base::Bind(is_official_build ? &VersionInfoUpdater::OnBootTimesNoop
64 base::Bind(is_official_build ? &VersionInfoUpdater::OnBootTimesNoop : 64 : &VersionInfoUpdater::OnBootTimes,
65 &VersionInfoUpdater::OnBootTimes, 65 base::Unretained(this)),
66 base::Unretained(this))); 66 &tracker_);
67 } else { 67 } else {
68 UpdateVersionLabel(); 68 UpdateVersionLabel();
69 } 69 }
70 70
71 policy::CloudPolicySubsystem* cloud_policy = 71 policy::CloudPolicySubsystem* cloud_policy =
72 g_browser_process->browser_policy_connector()-> 72 g_browser_process->browser_policy_connector()->
73 device_cloud_policy_subsystem(); 73 device_cloud_policy_subsystem();
74 if (cloud_policy) { 74 if (cloud_policy) {
75 // Two-step reset because we want to construct new ObserverRegistrar after 75 // Two-step reset because we want to construct new ObserverRegistrar after
76 // destruction of old ObserverRegistrar to avoid DCHECK violation because 76 // destruction of old ObserverRegistrar to avoid DCHECK violation because
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 } 191 }
192 192
193 void VersionInfoUpdater::OnVersion( 193 void VersionInfoUpdater::OnVersion(
194 VersionLoader::Handle handle, const std::string& version) { 194 VersionLoader::Handle handle, const std::string& version) {
195 version_text_ = version; 195 version_text_ = version;
196 UpdateVersionLabel(); 196 UpdateVersionLabel();
197 } 197 }
198 198
199 void VersionInfoUpdater::OnBootTimesNoop( 199 void VersionInfoUpdater::OnBootTimesNoop(
200 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { 200 const BootTimesLoader::BootTimes& boot_times) {}
201 }
202 201
203 void VersionInfoUpdater::OnBootTimes( 202 void VersionInfoUpdater::OnBootTimes(
204 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { 203 const BootTimesLoader::BootTimes& boot_times) {
205 const char* kBootTimesNoChromeExec = 204 const char* kBootTimesNoChromeExec =
206 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)"; 205 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)";
207 const char* kBootTimesChromeExec = 206 const char* kBootTimesChromeExec =
208 "Non-firmware boot took %.2f seconds " 207 "Non-firmware boot took %.2f seconds "
209 "(kernel %.2fs, system %.2fs, chrome %.2fs)"; 208 "(kernel %.2fs, system %.2fs, chrome %.2fs)";
210 std::string boot_times_text; 209 std::string boot_times_text;
211 210
212 if (boot_times.chrome > 0) { 211 if (boot_times.chrome > 0) {
213 boot_times_text = 212 boot_times_text =
214 base::StringPrintf( 213 base::StringPrintf(
(...skipping 25 matching lines...) Expand all
240 int type, 239 int type,
241 const content::NotificationSource& source, 240 const content::NotificationSource& source,
242 const content::NotificationDetails& details) { 241 const content::NotificationDetails& details) {
243 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED) 242 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED)
244 UpdateEnterpriseInfo(); 243 UpdateEnterpriseInfo();
245 else 244 else
246 NOTREACHED(); 245 NOTREACHED();
247 } 246 }
248 247
249 } // namespace chromeos 248 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698