Chromium Code Reviews| Index: chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
| diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
| index 70434098c7126d4cd19a96481ec20ce40a8064a6..b0b0c581caed68c581c426202fc63f0307e575a0 100644 |
| --- a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
| +++ b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| #include "base/bind.h" |
| +#include "base/metrics/sparse_histogram.h" |
| #include "base/sequenced_task_runner.h" |
| #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
| #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| @@ -22,6 +23,7 @@ DeviceCloudPolicyStoreChromeOS::DeviceCloudPolicyStoreChromeOS( |
| : device_settings_service_(device_settings_service), |
| install_attributes_(install_attributes), |
| background_task_runner_(background_task_runner), |
| + uma_done_(false), |
| weak_factory_(this) { |
| device_settings_service_->AddObserver(this); |
| } |
| @@ -133,6 +135,20 @@ void DeviceCloudPolicyStoreChromeOS::UpdateFromService() { |
| return; |
| } |
| + // Fill UMA histogram once per session. Skip temp validation error because it |
| + // is not a definitive result (policy load will be retried). |
| + const chromeos::DeviceSettingsService::Status status = |
| + device_settings_service_->status(); |
| + if (!uma_done_ && |
| + status != chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR) { |
| + uma_done_ = true; |
| + UMA_HISTOGRAM_SPARSE_SLOWLY( |
| + "Enterprise.EnrolledPolicyHasDMToken", |
|
Alexei Svitkine (slow)
2014/05/26 17:27:11
This looks like a boolean histogram, so there's no
Thiemo Nagel
2014/05/26 17:54:30
Thanks for catching this! I had started with a mo
|
| + status == chromeos::DeviceSettingsService::STORE_SUCCESS && |
| + device_settings_service_->policy_data() && |
| + !device_settings_service_->policy_data()->has_request_token()); |
|
Alexei Svitkine (slow)
2014/05/26 17:27:11
Nit: Refactor this into a local bool and use that
Thiemo Nagel
2014/05/26 17:54:30
Done.
|
| + } |
| + |
| switch (device_settings_service_->status()) { |
| case chromeos::DeviceSettingsService::STORE_SUCCESS: { |
| status_ = STATUS_OK; |