| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/user_policy_disk_cache.h" | 5 #include "chrome/browser/policy/user_policy_disk_cache.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" | 
| 11 #include "chrome/browser/policy/enterprise_metrics.h" | 11 #include "chrome/browser/policy/enterprise_metrics.h" | 
| 12 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 12 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" | 
| 14 | 14 | 
|  | 15 using content::BrowserThread; | 
|  | 16 | 
| 15 namespace { | 17 namespace { | 
| 16 | 18 | 
| 17 // Other places can sample on the same UMA counter, so make sure they all do | 19 // Other places can sample on the same UMA counter, so make sure they all do | 
| 18 // it on the same thread (UI). | 20 // it on the same thread (UI). | 
| 19 void SampleUMAOnUIThread(policy::MetricPolicy sample) { | 21 void SampleUMAOnUIThread(policy::MetricPolicy sample) { | 
| 20   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 22   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 21   UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, sample, | 23   UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, sample, | 
| 22                             policy::kMetricPolicySize); | 24                             policy::kMetricPolicySize); | 
| 23 } | 25 } | 
| 24 | 26 | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 135   int size = data.size(); | 137   int size = data.size(); | 
| 136   if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) { | 138   if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) { | 
| 137     LOG(WARNING) << "Failed to write " << backing_file_path_.value(); | 139     LOG(WARNING) << "Failed to write " << backing_file_path_.value(); | 
| 138     SampleUMA(kMetricPolicyStoreFailed); | 140     SampleUMA(kMetricPolicyStoreFailed); | 
| 139     return; | 141     return; | 
| 140   } | 142   } | 
| 141   SampleUMA(kMetricPolicyStoreSucceeded); | 143   SampleUMA(kMetricPolicyStoreSucceeded); | 
| 142 } | 144 } | 
| 143 | 145 | 
| 144 }  // namespace policy | 146 }  // namespace policy | 
| OLD | NEW | 
|---|