OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/policy_load_status.h" | 5 #include "chrome/browser/policy/policy_load_status.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/policy/policy_types.h" | 9 #include "components/policy/core/common/policy_types.h" |
10 | 10 |
11 namespace policy { | 11 namespace policy { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const char kHistogramName[] = "Enterprise.PolicyLoadStatus"; | 15 const char kHistogramName[] = "Enterprise.PolicyLoadStatus"; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 PolicyLoadStatusSample::PolicyLoadStatusSample() | 19 PolicyLoadStatusSample::PolicyLoadStatusSample() |
20 : histogram_(base::LinearHistogram::FactoryGet( | 20 : histogram_(base::LinearHistogram::FactoryGet( |
21 kHistogramName, 1, POLICY_LOAD_STATUS_SIZE, | 21 kHistogramName, 1, POLICY_LOAD_STATUS_SIZE, |
22 POLICY_LOAD_STATUS_SIZE + 1, | 22 POLICY_LOAD_STATUS_SIZE + 1, |
23 base::Histogram::kUmaTargetedHistogramFlag)) { | 23 base::Histogram::kUmaTargetedHistogramFlag)) { |
24 Add(POLICY_LOAD_STATUS_STARTED); | 24 Add(POLICY_LOAD_STATUS_STARTED); |
25 } | 25 } |
26 | 26 |
27 PolicyLoadStatusSample::~PolicyLoadStatusSample() { | 27 PolicyLoadStatusSample::~PolicyLoadStatusSample() { |
28 for (int i = 0; i < POLICY_LOAD_STATUS_SIZE; ++i) { | 28 for (int i = 0; i < POLICY_LOAD_STATUS_SIZE; ++i) { |
29 if (status_bits_[i]) | 29 if (status_bits_[i]) |
30 histogram_->Add(i); | 30 histogram_->Add(i); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 void PolicyLoadStatusSample::Add(PolicyLoadStatus status) { | 34 void PolicyLoadStatusSample::Add(PolicyLoadStatus status) { |
35 status_bits_[status] = true; | 35 status_bits_[status] = true; |
36 } | 36 } |
37 | 37 |
38 } // namespace policy | 38 } // namespace policy |
OLD | NEW |