OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ |
6 #define CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ | 6 #define CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
14 #include "chrome/browser/ui/browser_list_observer.h" | 14 #include "chrome/browser/ui/browser_list_observer.h" |
15 #include "components/metrics/metrics_provider.h" | 15 #include "components/metrics/metrics_provider.h" |
16 #include "components/signin/core/browser/signin_manager_base.h" | 16 #include "components/signin/core/browser/signin_manager_base.h" |
17 | 17 |
18 class Browser; | 18 class Browser; |
| 19 class ChromeUserMetricsExtension; |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class FilePath; | 22 class FilePath; |
22 } | 23 } |
23 | 24 |
| 25 namespace metrics { |
| 26 class ChromeUserMetricsExtension; |
| 27 } |
| 28 |
24 // Collect login status of all opened profiles during one UMA session and record | 29 // Collect login status of all opened profiles during one UMA session and record |
25 // the value into a histogram before UMA log is uploaded. It's currently not | 30 // the value into a histogram before UMA log is uploaded. It's currently not |
26 // supported on platform chromeos, Android or iOS. | 31 // supported on platform chromeos, Android or iOS. |
27 class SigninStatusMetricsProvider : public metrics::MetricsProvider, | 32 class SigninStatusMetricsProvider : public metrics::MetricsProvider, |
28 public chrome::BrowserListObserver, | 33 public chrome::BrowserListObserver, |
29 public SigninManagerBase::Observer, | 34 public SigninManagerBase::Observer, |
30 public SigninManagerFactory::Observer { | 35 public SigninManagerFactory::Observer { |
31 public: | 36 public: |
32 virtual ~SigninStatusMetricsProvider(); | 37 virtual ~SigninStatusMetricsProvider(); |
33 | 38 |
34 // Record the collected sign-in status into a histogram and re-check current | 39 // metrics::MetricsProvider: |
35 // sign-in status to get prepared for the next UMA session. Called by | 40 void ProvideGeneralMetrics( |
36 // MetricsServiceClient when it is collecting final metrics. | 41 metrics::ChromeUserMetricsExtension* uma_proto) override; |
37 void RecordSigninStatusHistogram(); | |
38 | 42 |
39 // Factory method, creates a new instance of this class. | 43 // Factory method, creates a new instance of this class. |
40 static SigninStatusMetricsProvider* CreateInstance(); | 44 static SigninStatusMetricsProvider* CreateInstance(); |
41 | 45 |
42 private: | 46 private: |
43 // The boolean |is_test| indicates whether or not this is an instance for | 47 // The boolean |is_test| indicates whether or not this is an instance for |
44 // testing purpose. If so, skip the initialization. Except for testing | 48 // testing purpose. If so, skip the initialization. Except for testing |
45 // purpose, this class's instance should be created through the static | 49 // purpose, this class's instance should be created through the static |
46 // CreateInstance() method. | 50 // CreateInstance() method. |
47 explicit SigninStatusMetricsProvider(bool is_test); | 51 explicit SigninStatusMetricsProvider(bool is_test); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 117 |
114 // Whether the instance is for testing or not. | 118 // Whether the instance is for testing or not. |
115 bool is_test_; | 119 bool is_test_; |
116 | 120 |
117 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; | 121 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; |
118 | 122 |
119 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); | 123 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); |
120 }; | 124 }; |
121 | 125 |
122 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ | 126 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ |
OLD | NEW |