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

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

Issue 22262004: Drop struct BootStat and all usage (boot stats are now sent from chromeos code). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months 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
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void VersionInfoUpdater::StartUpdate(bool is_official_build) { 61 void VersionInfoUpdater::StartUpdate(bool is_official_build) {
62 if (base::chromeos::IsRunningOnChromeOS()) { 62 if (base::chromeos::IsRunningOnChromeOS()) {
63 version_loader_.GetVersion( 63 version_loader_.GetVersion(
64 is_official_build ? VersionLoader::VERSION_SHORT_WITH_DATE 64 is_official_build ? VersionLoader::VERSION_SHORT_WITH_DATE
65 : VersionLoader::VERSION_FULL, 65 : VersionLoader::VERSION_FULL,
66 base::Bind(&VersionInfoUpdater::OnVersion, 66 base::Bind(&VersionInfoUpdater::OnVersion,
67 weak_pointer_factory_.GetWeakPtr()), 67 weak_pointer_factory_.GetWeakPtr()),
68 &tracker_); 68 &tracker_);
69 boot_times_loader_.GetBootTimes(
70 base::Bind(is_official_build ? &VersionInfoUpdater::OnBootTimesNoop
71 : &VersionInfoUpdater::OnBootTimes,
72 weak_pointer_factory_.GetWeakPtr()),
73 &tracker_);
74 } else { 69 } else {
75 UpdateVersionLabel(); 70 UpdateVersionLabel();
76 } 71 }
77 72
78 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = 73 policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
79 g_browser_process->browser_policy_connector()-> 74 g_browser_process->browser_policy_connector()->
80 GetDeviceCloudPolicyManager(); 75 GetDeviceCloudPolicyManager();
81 if (policy_manager) { 76 if (policy_manager) {
82 policy_manager->core()->store()->AddObserver(this); 77 policy_manager->core()->store()->AddObserver(this);
83 78
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 UTF8ToUTF16(domain_name)); 119 UTF8ToUTF16(domain_name));
125 delegate_->OnEnterpriseInfoUpdated(enterprise_info); 120 delegate_->OnEnterpriseInfoUpdated(enterprise_info);
126 } 121 }
127 } 122 }
128 123
129 void VersionInfoUpdater::OnVersion(const std::string& version) { 124 void VersionInfoUpdater::OnVersion(const std::string& version) {
130 version_text_ = version; 125 version_text_ = version;
131 UpdateVersionLabel(); 126 UpdateVersionLabel();
132 } 127 }
133 128
134 void VersionInfoUpdater::OnBootTimesNoop(
135 const BootTimesLoader::BootTimes& boot_times) {}
136
137 void VersionInfoUpdater::OnBootTimes(
138 const BootTimesLoader::BootTimes& boot_times) {
139 const char* kBootTimesNoChromeExec =
140 "Non-firmware boot took %.2f seconds (kernel %.2fs, system %.2fs)";
141 const char* kBootTimesChromeExec =
142 "Non-firmware boot took %.2f seconds "
143 "(kernel %.2fs, system %.2fs, chrome %.2fs)";
144 std::string boot_times_text;
145
146 if (boot_times.chrome > 0) {
147 boot_times_text =
148 base::StringPrintf(
149 kBootTimesChromeExec,
150 boot_times.total,
151 boot_times.pre_startup,
152 boot_times.system,
153 boot_times.chrome);
154 } else {
155 boot_times_text =
156 base::StringPrintf(
157 kBootTimesNoChromeExec,
158 boot_times.total,
159 boot_times.pre_startup,
160 boot_times.system);
161 }
162 // Use UTF8ToWide once this string is localized.
163 if (delegate_)
164 delegate_->OnBootTimesLabelTextUpdated(boot_times_text);
165 }
166
167 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { 129 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) {
168 UpdateEnterpriseInfo(); 130 UpdateEnterpriseInfo();
169 } 131 }
170 132
171 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { 133 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) {
172 UpdateEnterpriseInfo(); 134 UpdateEnterpriseInfo();
173 } 135 }
174 136
175 void VersionInfoUpdater::Observe( 137 void VersionInfoUpdater::Observe(
176 int type, 138 int type,
177 const content::NotificationSource& source, 139 const content::NotificationSource& source,
178 const content::NotificationDetails& details) { 140 const content::NotificationDetails& details) {
179 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED) 141 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED)
180 UpdateEnterpriseInfo(); 142 UpdateEnterpriseInfo();
181 else 143 else
182 NOTREACHED(); 144 NOTREACHED();
183 } 145 }
184 146
185 } // namespace chromeos 147 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/version_info_updater.h ('k') | chrome/browser/resources/chromeos/login/version.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698