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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
18 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/common/chrome_version_info.h" | |
21 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
22 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
23 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
| 23 #include "components/version_info/version_info.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 | 26 |
27 namespace chromeos { | 27 namespace chromeos { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 const char* const kReportingFlags[] = { | 31 const char* const kReportingFlags[] = { |
32 chromeos::kReportDeviceVersionInfo, | 32 chromeos::kReportDeviceVersionInfo, |
33 chromeos::kReportDeviceActivityTimes, | 33 chromeos::kReportDeviceActivityTimes, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 callback).release()); | 94 callback).release()); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 void VersionInfoUpdater::UpdateVersionLabel() { | 98 void VersionInfoUpdater::UpdateVersionLabel() { |
99 if (version_text_.empty()) | 99 if (version_text_.empty()) |
100 return; | 100 return; |
101 | 101 |
102 UpdateSerialNumberInfo(); | 102 UpdateSerialNumberInfo(); |
103 | 103 |
104 chrome::VersionInfo version_info; | |
105 std::string label_text = l10n_util::GetStringFUTF8( | 104 std::string label_text = l10n_util::GetStringFUTF8( |
106 IDS_LOGIN_VERSION_LABEL_FORMAT, | 105 IDS_LOGIN_VERSION_LABEL_FORMAT, |
107 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 106 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
108 base::UTF8ToUTF16(version_info.Version()), | 107 base::UTF8ToUTF16(version_info::GetVersionNumber()), |
109 base::UTF8ToUTF16(version_text_), | 108 base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(serial_number_text_)); |
110 base::UTF8ToUTF16(serial_number_text_)); | |
111 | 109 |
112 // Workaround over incorrect width calculation in old fonts. | 110 // Workaround over incorrect width calculation in old fonts. |
113 // TODO(glotov): remove the following line when new fonts are used. | 111 // TODO(glotov): remove the following line when new fonts are used. |
114 label_text += ' '; | 112 label_text += ' '; |
115 | 113 |
116 if (delegate_) | 114 if (delegate_) |
117 delegate_->OnOSVersionLabelTextUpdated(label_text); | 115 delegate_->OnOSVersionLabelTextUpdated(label_text); |
118 } | 116 } |
119 | 117 |
120 void VersionInfoUpdater::UpdateEnterpriseInfo() { | 118 void VersionInfoUpdater::UpdateEnterpriseInfo() { |
(...skipping 30 matching lines...) Expand all Loading... |
151 | 149 |
152 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { | 150 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { |
153 UpdateEnterpriseInfo(); | 151 UpdateEnterpriseInfo(); |
154 } | 152 } |
155 | 153 |
156 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { | 154 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { |
157 UpdateEnterpriseInfo(); | 155 UpdateEnterpriseInfo(); |
158 } | 156 } |
159 | 157 |
160 } // namespace chromeos | 158 } // namespace chromeos |
OLD | NEW |