Chromium Code Reviews| Index: chrome/browser/policy/policy_load_status.h |
| diff --git a/chrome/browser/policy/policy_load_status.h b/chrome/browser/policy/policy_load_status.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ad6942f350bfff1981a1f02e19e48651b847dc4 |
| --- /dev/null |
| +++ b/chrome/browser/policy/policy_load_status.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ |
| +#define CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ |
| + |
| +#include <string> |
|
Joao da Silva
2013/04/16 17:31:04
Not used
Mattias Nissler (ping if slow)
2013/04/16 18:51:14
Done.
|
| + |
| +#include "base/basictypes.h" |
| + |
| +namespace base { |
| +class HistogramBase; |
| +} |
| + |
| +namespace policy { |
| + |
| +// UMA histogram enum for policy load status. Don't change existing constants, |
| +// append additional constants to the end if needed. |
| +enum PolicyLoadStatus { |
| + // Policy load attempt started. This gets logged for each policy load attempt |
| + // to get a baseline on the number of requests, and an arbitrary number of |
| + // the below status codes may get added in addition. |
| + POLICY_LOAD_STATUS_STARTED = 1, |
| + // System failed to determine whether there's policy. |
| + POLICY_LOAD_STATUS_QUERY_FAILED, |
| + // No policy present. |
| + POLICY_LOAD_STATUS_NO_POLICY, |
| + // Data inaccessible, such as non-local policy file. |
| + POLICY_LOAD_STATUS_INACCCESSIBLE, |
| + // Data missing, such as policy file not present. |
| + POLICY_LOAD_STATUS_MISSING, |
| + // Trying with Wow64 redirection disabled. |
| + POLICY_LOAD_STATUS_WOW64_REDIRECTION_DISABLED, |
| + // Data read error, for example file reading errors. |
| + POLICY_LOAD_STATUS_READ_ERROR, |
| + // Data too large to process. |
| + POLICY_LOAD_STATUS_TOO_BIG, |
| + // Parse error. |
| + POLICY_LOAD_STATUS_PARSE_ERROR, |
| + |
| + // This must stay last. |
| + POLICY_LOAD_STATUS_SIZE |
| +}; |
| + |
| +// A helper for generating policy load status UMA statistics that'll log |
| +// histogram samples for a policy load operation to the appropriate histogram. |
| +class PolicyLoadStatusSample { |
| + public: |
| + // |scope| and |level| may be a PolicyScope or PolicyLevel value |
| + // respectively, or alternatively -1 to indicate n/a. |
| + PolicyLoadStatusSample(int scope, int level); |
| + |
| + // Adds a status code. |
| + void Add(PolicyLoadStatus status); |
| + |
| + private: |
| + base::HistogramBase* histogram_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample); |
| +}; |
| + |
| +} // namespace policy |
| + |
| +#endif // CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ |