| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Collect login status of all opened profiles during one UMA session and record | 24 // 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 | 25 // the value into a histogram before UMA log is uploaded. It's currently not |
| 26 // supported on platform chromeos, Android or iOS. | 26 // supported on platform chromeos, Android or iOS. |
| 27 class SigninStatusMetricsProvider : public metrics::MetricsProvider, | 27 class SigninStatusMetricsProvider : public metrics::MetricsProvider, |
| 28 public chrome::BrowserListObserver, | 28 public chrome::BrowserListObserver, |
| 29 public SigninManagerBase::Observer, | 29 public SigninManagerBase::Observer, |
| 30 public SigninManagerFactory::Observer { | 30 public SigninManagerFactory::Observer { |
| 31 public: | 31 public: |
| 32 virtual ~SigninStatusMetricsProvider(); | 32 virtual ~SigninStatusMetricsProvider(); |
| 33 | 33 |
| 34 // Record the collected sign-in status into a histogram and re-check current | 34 // metrics::MetricsProvider: |
| 35 // sign-in status to get prepared for the next UMA session. Called by | 35 void OnCollectFinalMetrics() override; |
| 36 // MetricsServiceClient when it is collecting final metrics. | |
| 37 void RecordSigninStatusHistogram(); | |
| 38 | 36 |
| 39 // Factory method, creates a new instance of this class. | 37 // Factory method, creates a new instance of this class. |
| 40 static SigninStatusMetricsProvider* CreateInstance(); | 38 static SigninStatusMetricsProvider* CreateInstance(); |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 // The boolean |is_test| indicates whether or not this is an instance for | 41 // The boolean |is_test| indicates whether or not this is an instance for |
| 44 // testing purpose. If so, skip the initialization. Except for testing | 42 // testing purpose. If so, skip the initialization. Except for testing |
| 45 // purpose, this class's instance should be created through the static | 43 // purpose, this class's instance should be created through the static |
| 46 // CreateInstance() method. | 44 // CreateInstance() method. |
| 47 explicit SigninStatusMetricsProvider(bool is_test); | 45 explicit SigninStatusMetricsProvider(bool is_test); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 111 |
| 114 // Whether the instance is for testing or not. | 112 // Whether the instance is for testing or not. |
| 115 bool is_test_; | 113 bool is_test_; |
| 116 | 114 |
| 117 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; | 115 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; |
| 118 | 116 |
| 119 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); | 117 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); |
| 120 }; | 118 }; |
| 121 | 119 |
| 122 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ | 120 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ |
| OLD | NEW |