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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_LOAD_STATUS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOAD_STATUS_H_
10 #include "base/basictypes.h"
11 #include "components/policy/policy_export.h"
19 // UMA histogram enum for policy load status. Don't change existing constants,
20 // append additional constants to the end if needed.
21 enum PolicyLoadStatus
{
22 // Policy load attempt started. This gets logged for each policy load attempt
23 // to get a baseline on the number of requests, and an arbitrary number of
24 // the below status codes may get added in addition.
25 POLICY_LOAD_STATUS_STARTED
,
26 // System failed to determine whether there's policy.
27 POLICY_LOAD_STATUS_QUERY_FAILED
,
29 POLICY_LOAD_STATUS_NO_POLICY
,
30 // Data inaccessible, such as non-local policy file.
31 POLICY_LOAD_STATUS_INACCCESSIBLE
,
32 // Data missing, such as policy file not present.
33 POLICY_LOAD_STATUS_MISSING
,
34 // Trying with Wow64 redirection disabled.
35 POLICY_LOAD_STATUS_WOW64_REDIRECTION_DISABLED
,
36 // Data read error, for example file reading errors.
37 POLICY_LOAD_STATUS_READ_ERROR
,
38 // Data too large to process.
39 POLICY_LOAD_STATUS_TOO_BIG
,
41 POLICY_LOAD_STATUS_PARSE_ERROR
,
43 // This must stay last.
44 POLICY_LOAD_STATUS_SIZE
47 // A helper for generating policy load status UMA statistics that'll collect
48 // histogram samples for a policy load operation and records histogram samples
49 // for the status codes that were seen on destruction.
50 class POLICY_EXPORT PolicyLoadStatusSample
{
52 PolicyLoadStatusSample();
53 ~PolicyLoadStatusSample();
55 // Adds a status code.
56 void Add(PolicyLoadStatus status
);
59 std::bitset
<POLICY_LOAD_STATUS_SIZE
> status_bits_
;
60 base::HistogramBase
* histogram_
;
62 DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample
);
67 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOAD_STATUS_H_