| 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 "ash/strings/grit/ash_strings.h" |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "base/task_scheduler/post_task.h" | 17 #include "base/task_scheduler/post_task.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 SetEnterpriseInfo(connector->GetEnterpriseDomain(), | 121 SetEnterpriseInfo(connector->GetEnterpriseDomain(), |
| 121 connector->GetDeviceAssetID()); | 122 connector->GetDeviceAssetID()); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name, | 125 void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name, |
| 125 const std::string& asset_id) { | 126 const std::string& asset_id) { |
| 126 // Update the notification about device status reporting. | 127 // Update the notification about device status reporting. |
| 127 if (delegate_ && !domain_name.empty()) { | 128 if (delegate_ && !domain_name.empty()) { |
| 128 std::string enterprise_info; | 129 std::string enterprise_info; |
| 129 enterprise_info = l10n_util::GetStringFUTF8( | 130 enterprise_info = l10n_util::GetStringFUTF8( |
| 130 IDS_DEVICE_OWNED_BY_NOTICE, | 131 IDS_ASH_ENTERPRISE_DEVICE_MANAGED_BY, base::UTF8ToUTF16(domain_name)); |
| 131 base::UTF8ToUTF16(domain_name)); | |
| 132 delegate_->OnEnterpriseInfoUpdated(enterprise_info, asset_id); | 132 delegate_->OnEnterpriseInfoUpdated(enterprise_info, asset_id); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void VersionInfoUpdater::UpdateSerialNumberInfo() { | 136 void VersionInfoUpdater::UpdateSerialNumberInfo() { |
| 137 std::string serial = | 137 std::string serial = |
| 138 system::StatisticsProvider::GetInstance()->GetEnterpriseMachineID(); | 138 system::StatisticsProvider::GetInstance()->GetEnterpriseMachineID(); |
| 139 if (!serial.empty()) { | 139 if (!serial.empty()) { |
| 140 serial_number_text_ = kSerialNumberPrefix; | 140 serial_number_text_ = kSerialNumberPrefix; |
| 141 serial_number_text_.append(serial); | 141 serial_number_text_.append(serial); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 void VersionInfoUpdater::OnVersion(const std::string& version) { | 145 void VersionInfoUpdater::OnVersion(const std::string& version) { |
| 146 version_text_ = version; | 146 version_text_ = version; |
| 147 UpdateVersionLabel(); | 147 UpdateVersionLabel(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { | 150 void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { |
| 151 UpdateEnterpriseInfo(); | 151 UpdateEnterpriseInfo(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { | 154 void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { |
| 155 UpdateEnterpriseInfo(); | 155 UpdateEnterpriseInfo(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace chromeos | 158 } // namespace chromeos |
| OLD | NEW |