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