| 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/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/task_runner_util.h" | 16 #include "base/task_runner_util.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 19 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | |
| 20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.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 "chromeos/system/statistics_provider.h" |
| 24 #include "components/version_info/version_info.h" | 24 #include "components/version_info/version_info.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const char* const kReportingFlags[] = { | 32 const char* const kReportingFlags[] = { |
| 33 chromeos::kReportDeviceVersionInfo, | 33 chromeos::kReportDeviceVersionInfo, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (delegate_ && !domain_name.empty()) { | 129 if (delegate_ && !domain_name.empty()) { |
| 130 std::string enterprise_info; | 130 std::string enterprise_info; |
| 131 enterprise_info = l10n_util::GetStringFUTF8( | 131 enterprise_info = l10n_util::GetStringFUTF8( |
| 132 IDS_DEVICE_OWNED_BY_NOTICE, | 132 IDS_DEVICE_OWNED_BY_NOTICE, |
| 133 base::UTF8ToUTF16(domain_name)); | 133 base::UTF8ToUTF16(domain_name)); |
| 134 delegate_->OnEnterpriseInfoUpdated(enterprise_info, asset_id); | 134 delegate_->OnEnterpriseInfoUpdated(enterprise_info, asset_id); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void VersionInfoUpdater::UpdateSerialNumberInfo() { | 138 void VersionInfoUpdater::UpdateSerialNumberInfo() { |
| 139 std::string sn = policy::DeviceCloudPolicyManagerChromeOS::GetMachineID(); | 139 std::string serial = |
| 140 if (!sn.empty()) { | 140 system::StatisticsProvider::GetInstance()->GetEnterpriseMachineID(); |
| 141 if (!serial.empty()) { |
| 141 serial_number_text_ = kSerialNumberPrefix; | 142 serial_number_text_ = kSerialNumberPrefix; |
| 142 serial_number_text_.append(sn); | 143 serial_number_text_.append(serial); |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 | 146 |
| 146 void VersionInfoUpdater::OnVersion(const std::string& version) { | 147 void VersionInfoUpdater::OnVersion(const std::string& version) { |
| 147 version_text_ = version; | 148 version_text_ = version; |
| 148 UpdateVersionLabel(); | 149 UpdateVersionLabel(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { | 152 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { |
| 152 UpdateEnterpriseInfo(); | 153 UpdateEnterpriseInfo(); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { | 156 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { |
| 156 UpdateEnterpriseInfo(); | 157 UpdateEnterpriseInfo(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace chromeos | 160 } // namespace chromeos |
| OLD | NEW |