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..efa3a013acf703691f1c99ef7ec7fab97286d0c5 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,7 +135,21 @@ void DeviceCloudPolicyStoreChromeOS::UpdateFromService() { |
return; |
} |
- switch (device_settings_service_->status()) { |
+ // 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(); |
Mattias Nissler (ping if slow)
2014/05/26 07:54:11
nit: equals sign goes on previous line.
Thiemo Nagel
2014/05/26 10:53:55
Done.
|
+ if (!uma_done_ && |
+ status != chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR) { |
+ uma_done_ = true; |
+ int uma_status = static_cast<int>(status); |
+ if (status == chromeos::DeviceSettingsService::STORE_SUCCESS && |
+ !device_settings_service_->policy_data()->has_request_token()) |
Mattias Nissler (ping if slow)
2014/05/26 07:54:11
You're dereferencing policy_data() here without ch
Thiemo Nagel
2014/05/26 10:53:55
Thanks. I've added a check. (I'd like to keep th
|
+ uma_status = 7; // Success but has no DM token. |
Mattias Nissler (ping if slow)
2014/05/26 07:54:11
This is dangerous, as whatever changes we make to
Thiemo Nagel
2014/05/26 10:53:55
I've simplified the CL so that this doesn't apply
|
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Enterprise.EnrolledPolicyLoad", uma_status); |
+ } |
+ |
+ switch (status) { |
case chromeos::DeviceSettingsService::STORE_SUCCESS: { |
status_ = STATUS_OK; |
policy_.reset(new em::PolicyData()); |