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 if (!has_dm_token) { | |
152 LOG(ERROR) << "Policy read on enrolled device yields no DM token! " | |
153 << "Status: " << status << "."; | |
pastarmovj
2014/06/02 15:35:53
You should use LOG_IF here.
Thiemo Nagel
2014/06/02 19:40:50
Done.
| |
154 } | |
150 } | 155 } |
151 | 156 |
152 switch (device_settings_service_->status()) { | 157 switch (device_settings_service_->status()) { |
153 case chromeos::DeviceSettingsService::STORE_SUCCESS: { | 158 case chromeos::DeviceSettingsService::STORE_SUCCESS: { |
154 status_ = STATUS_OK; | 159 status_ = STATUS_OK; |
155 policy_.reset(new em::PolicyData()); | 160 policy_.reset(new em::PolicyData()); |
156 if (device_settings_service_->policy_data()) | 161 if (device_settings_service_->policy_data()) |
157 policy_->MergeFrom(*device_settings_service_->policy_data()); | 162 policy_->MergeFrom(*device_settings_service_->policy_data()); |
158 | 163 |
159 PolicyMap new_policy_map; | 164 PolicyMap new_policy_map; |
(...skipping 18 matching lines...) Expand all Loading... | |
178 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: | 183 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: |
179 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: | 184 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: |
180 status_ = STATUS_LOAD_ERROR; | 185 status_ = STATUS_LOAD_ERROR; |
181 break; | 186 break; |
182 } | 187 } |
183 | 188 |
184 NotifyStoreError(); | 189 NotifyStoreError(); |
185 } | 190 } |
186 | 191 |
187 } // namespace policy | 192 } // namespace policy |
OLD | NEW |