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/policy/device_cloud_policy_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
9 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
10 #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" | 11 #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
11 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 12 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
12 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 13 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
13 #include "policy/proto/device_management_backend.pb.h" | 14 #include "policy/proto/device_management_backend.pb.h" |
14 | 15 |
15 namespace em = enterprise_management; | 16 namespace em = enterprise_management; |
16 | 17 |
17 namespace policy { | 18 namespace policy { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 const chromeos::DeviceSettingsService::Status status = | 141 const chromeos::DeviceSettingsService::Status status = |
141 device_settings_service_->status(); | 142 device_settings_service_->status(); |
142 if (!uma_done_ && | 143 if (!uma_done_ && |
143 status != chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR) { | 144 status != chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR) { |
144 uma_done_ = true; | 145 uma_done_ = true; |
145 const bool has_dm_token = | 146 const bool has_dm_token = |
146 status == chromeos::DeviceSettingsService::STORE_SUCCESS && | 147 status == chromeos::DeviceSettingsService::STORE_SUCCESS && |
147 device_settings_service_->policy_data() && | 148 device_settings_service_->policy_data() && |
148 device_settings_service_->policy_data()->has_request_token(); | 149 device_settings_service_->policy_data()->has_request_token(); |
149 UMA_HISTOGRAM_BOOLEAN("Enterprise.EnrolledPolicyHasDMToken", has_dm_token); | 150 UMA_HISTOGRAM_BOOLEAN("Enterprise.EnrolledPolicyHasDMToken", has_dm_token); |
| 151 LOG_IF(ERROR, !has_dm_token) |
| 152 << "Policy read on enrolled device yields no DM token! " |
| 153 << "Status: " << status << "."; |
150 } | 154 } |
151 | 155 |
152 switch (device_settings_service_->status()) { | 156 switch (device_settings_service_->status()) { |
153 case chromeos::DeviceSettingsService::STORE_SUCCESS: { | 157 case chromeos::DeviceSettingsService::STORE_SUCCESS: { |
154 status_ = STATUS_OK; | 158 status_ = STATUS_OK; |
155 policy_.reset(new em::PolicyData()); | 159 policy_.reset(new em::PolicyData()); |
156 if (device_settings_service_->policy_data()) | 160 if (device_settings_service_->policy_data()) |
157 policy_->MergeFrom(*device_settings_service_->policy_data()); | 161 policy_->MergeFrom(*device_settings_service_->policy_data()); |
158 | 162 |
159 PolicyMap new_policy_map; | 163 PolicyMap new_policy_map; |
(...skipping 18 matching lines...) Expand all Loading... |
178 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: | 182 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: |
179 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: | 183 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: |
180 status_ = STATUS_LOAD_ERROR; | 184 status_ = STATUS_LOAD_ERROR; |
181 break; | 185 break; |
182 } | 186 } |
183 | 187 |
184 NotifyStoreError(); | 188 NotifyStoreError(); |
185 } | 189 } |
186 | 190 |
187 } // namespace policy | 191 } // namespace policy |
OLD | NEW |