| 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 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 // 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 |
| 30 // 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 |
| 31 // supported on platform chromeos, Android or iOS. | 31 // supported on platform chromeos, Android or iOS. |
| 32 class SigninStatusMetricsProvider : public metrics::MetricsProvider, | 32 class SigninStatusMetricsProvider : public metrics::MetricsProvider, |
| 33 public chrome::BrowserListObserver, | 33 public chrome::BrowserListObserver, |
| 34 public SigninManagerBase::Observer, | 34 public SigninManagerBase::Observer, |
| 35 public SigninManagerFactory::Observer { | 35 public SigninManagerFactory::Observer { |
| 36 public: | 36 public: |
| 37 virtual ~SigninStatusMetricsProvider(); | 37 ~SigninStatusMetricsProvider() override; |
| 38 | 38 |
| 39 // metrics::MetricsProvider: | 39 // metrics::MetricsProvider: |
| 40 void ProvideGeneralMetrics( | 40 void ProvideGeneralMetrics( |
| 41 metrics::ChromeUserMetricsExtension* uma_proto) override; | 41 metrics::ChromeUserMetricsExtension* uma_proto) override; |
| 42 | 42 |
| 43 // Factory method, creates a new instance of this class. | 43 // Factory method, creates a new instance of this class. |
| 44 static SigninStatusMetricsProvider* CreateInstance(); | 44 static SigninStatusMetricsProvider* CreateInstance(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 ALL_PROFILES_SIGNED_IN, | 64 ALL_PROFILES_SIGNED_IN, |
| 65 ALL_PROFILES_NOT_SIGNED_IN, | 65 ALL_PROFILES_NOT_SIGNED_IN, |
| 66 MIXED_SIGNIN_STATUS, | 66 MIXED_SIGNIN_STATUS, |
| 67 UNKNOWN_SIGNIN_STATUS, | 67 UNKNOWN_SIGNIN_STATUS, |
| 68 ERROR_GETTING_SIGNIN_STATUS, | 68 ERROR_GETTING_SIGNIN_STATUS, |
| 69 SIGNIN_STATUS_MAX, | 69 SIGNIN_STATUS_MAX, |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // chrome::BrowserListObserver: | 72 // chrome::BrowserListObserver: |
| 73 // This will never be called on Android. | 73 // This will never be called on Android. |
| 74 virtual void OnBrowserAdded(Browser* browser) override; | 74 void OnBrowserAdded(Browser* browser) override; |
| 75 | 75 |
| 76 // SigninManagerFactory::Observer: | 76 // SigninManagerFactory::Observer: |
| 77 virtual void SigninManagerCreated(SigninManagerBase* manager) override; | 77 void SigninManagerCreated(SigninManagerBase* manager) override; |
| 78 virtual void SigninManagerShutdown(SigninManagerBase* manager) override; | 78 void SigninManagerShutdown(SigninManagerBase* manager) override; |
| 79 | 79 |
| 80 // SigninManagerBase::Observer: | 80 // SigninManagerBase::Observer: |
| 81 virtual void GoogleSigninSucceeded(const std::string& account_id, | 81 void GoogleSigninSucceeded(const std::string& account_id, |
| 82 const std::string& username, | 82 const std::string& username, |
| 83 const std::string& password) override; | 83 const std::string& password) override; |
| 84 virtual void GoogleSignedOut(const std::string& account_id, | 84 void GoogleSignedOut(const std::string& account_id, |
| 85 const std::string& username) override; | 85 const std::string& username) override; |
| 86 | 86 |
| 87 // Obtain sign-in status and add observers. | 87 // Obtain sign-in status and add observers. |
| 88 void Initialize(); | 88 void Initialize(); |
| 89 | 89 |
| 90 // Update the sign-in status based on all currently opened profiles. Called by | 90 // Update the sign-in status based on all currently opened profiles. Called by |
| 91 // ComputeCurrentSigninStatus at class construction and right after each UMA | 91 // ComputeCurrentSigninStatus at class construction and right after each UMA |
| 92 // log upload. |total_count| is the number of opened profiles and | 92 // log upload. |total_count| is the number of opened profiles and |
| 93 // |signed_in_count| represents the number of signed-in profiles among those | 93 // |signed_in_count| represents the number of signed-in profiles among those |
| 94 // |total_count| profiles. | 94 // |total_count| profiles. |
| 95 void UpdateInitialSigninStatus(size_t total_count, size_t signed_in_count); | 95 void UpdateInitialSigninStatus(size_t total_count, size_t signed_in_count); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 117 | 117 |
| 118 // Whether the instance is for testing or not. | 118 // Whether the instance is for testing or not. |
| 119 bool is_test_; | 119 bool is_test_; |
| 120 | 120 |
| 121 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; | 121 base::WeakPtrFactory<SigninStatusMetricsProvider> weak_ptr_factory_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); | 123 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProvider); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ | 126 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_H_ |
| OLD | NEW |