Chromium Code Reviews| Index: components/policy/core/common/policy_load_status.h |
| diff --git a/components/policy/core/common/policy_load_status.h b/components/policy/core/common/policy_load_status.h |
| index 6c9e907152f44a3a107cca7ab1bf99b3922c8961..82815376b498ee7886d9c02b3d8ba1449f817c2c 100644 |
| --- a/components/policy/core/common/policy_load_status.h |
| +++ b/components/policy/core/common/policy_load_status.h |
| @@ -7,13 +7,10 @@ |
| #include <bitset> |
| +#include "base/callback.h" |
| #include "base/macros.h" |
| #include "components/policy/policy_export.h" |
| -namespace base { |
| -class HistogramBase; |
| -} |
| - |
| namespace policy { |
| // UMA histogram enum for policy load status. Don't change existing constants, |
| @@ -49,7 +46,14 @@ enum PolicyLoadStatus { |
| // for the status codes that were seen on destruction. |
| class POLICY_EXPORT PolicyLoadStatusSample { |
| public: |
| - PolicyLoadStatusSample(); |
| + using ReportCallback = base::Callback<void(PolicyLoadStatus status)>; |
| + |
| + // If |report_callback| is set, status is sent to this callback. Otherwise, |
|
emaxx
2017/05/04 13:00:34
To me this looks like stretching a single class fo
ljusten (tachyonic)
2017/05/05 08:16:27
Thanks, I like that better.
|
| + // status is sent to a base::LinearHistogram with name |kHistogramName|. Set |
| + // the callback in situations where base::LinearHistogram cannot be used, e.g. |
| + // when called from Chromium OS code. |
| + PolicyLoadStatusSample( |
| + const ReportCallback& report_callback = ReportCallback()); |
| ~PolicyLoadStatusSample(); |
| // Adds a status code. |
| @@ -57,7 +61,7 @@ class POLICY_EXPORT PolicyLoadStatusSample { |
| private: |
| std::bitset<POLICY_LOAD_STATUS_SIZE> status_bits_; |
| - base::HistogramBase* histogram_; |
| + ReportCallback report_callback_; |
| DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample); |
| }; |