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 #include "chrome/browser/metrics/signin_status_metrics_provider.h" | 5 #include "chrome/browser/metrics/signin_status_metrics_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 #if !defined(OS_ANDROID) | 65 #if !defined(OS_ANDROID) |
66 BrowserList::RemoveObserver(this); | 66 BrowserList::RemoveObserver(this); |
67 #endif | 67 #endif |
68 | 68 |
69 SigninManagerFactory* factory = SigninManagerFactory::GetInstance(); | 69 SigninManagerFactory* factory = SigninManagerFactory::GetInstance(); |
70 if (factory) | 70 if (factory) |
71 factory->RemoveObserver(this); | 71 factory->RemoveObserver(this); |
72 } | 72 } |
73 | 73 |
74 void SigninStatusMetricsProvider::RecordSigninStatusHistogram() { | 74 void SigninStatusMetricsProvider::ProvideGeneralMetrics( |
| 75 metrics::ChromeUserMetricsExtension* uma_proto) { |
75 UMA_HISTOGRAM_ENUMERATION( | 76 UMA_HISTOGRAM_ENUMERATION( |
76 "UMA.ProfileSignInStatus", signin_status_, SIGNIN_STATUS_MAX); | 77 "UMA.ProfileSignInStatus", signin_status_, SIGNIN_STATUS_MAX); |
77 // After a histogram value is recorded, a new UMA session will be started, so | 78 // After a histogram value is recorded, a new UMA session will be started, so |
78 // we need to re-check the current sign-in status regardless of the previous | 79 // we need to re-check the current sign-in status regardless of the previous |
79 // recorded |signin_status_| value. | 80 // recorded |signin_status_| value. |
80 signin_status_ = UNKNOWN_SIGNIN_STATUS; | 81 signin_status_ = UNKNOWN_SIGNIN_STATUS; |
81 ComputeCurrentSigninStatus(); | 82 ComputeCurrentSigninStatus(); |
82 } | 83 } |
83 | 84 |
84 // static | 85 // static |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 SetSigninStatus(MIXED_SIGNIN_STATUS); | 195 SetSigninStatus(MIXED_SIGNIN_STATUS); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 void SigninStatusMetricsProvider::UpdateStatusWhenBrowserAdded(bool signed_in) { | 199 void SigninStatusMetricsProvider::UpdateStatusWhenBrowserAdded(bool signed_in) { |
199 #if !defined(OS_ANDROID) | 200 #if !defined(OS_ANDROID) |
200 if ((signin_status_ == ALL_PROFILES_NOT_SIGNED_IN && signed_in) || | 201 if ((signin_status_ == ALL_PROFILES_NOT_SIGNED_IN && signed_in) || |
201 (signin_status_ == ALL_PROFILES_SIGNED_IN && !signed_in)) { | 202 (signin_status_ == ALL_PROFILES_SIGNED_IN && !signed_in)) { |
202 SetSigninStatus(MIXED_SIGNIN_STATUS); | 203 SetSigninStatus(MIXED_SIGNIN_STATUS); |
203 } else if (signin_status_ == UNKNOWN_SIGNIN_STATUS) { | 204 } else if (signin_status_ == UNKNOWN_SIGNIN_STATUS) { |
204 // If when function RecordSigninStatusHistogram() is called, Chrome is | 205 // If when function ProvideGeneralMetrics() is called, Chrome is |
205 // running in the background with no browser window opened, |signin_status_| | 206 // running in the background with no browser window opened, |signin_status_| |
206 // will be reset to |UNKNOWN_SIGNIN_STATUS|. Then this newly added browser | 207 // will be reset to |UNKNOWN_SIGNIN_STATUS|. Then this newly added browser |
207 // is the only opened browser/profile and its signin status represents | 208 // is the only opened browser/profile and its signin status represents |
208 // the whole status. | 209 // the whole status. |
209 SetSigninStatus(signed_in ? ALL_PROFILES_SIGNED_IN : | 210 SetSigninStatus(signed_in ? ALL_PROFILES_SIGNED_IN : |
210 ALL_PROFILES_NOT_SIGNED_IN); | 211 ALL_PROFILES_NOT_SIGNED_IN); |
211 } | 212 } |
212 #endif | 213 #endif |
213 } | 214 } |
214 | 215 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 RecordComputeSigninStatusHistogram(TRY_TO_OVERRIDE_ERROR_STATUS); | 255 RecordComputeSigninStatusHistogram(TRY_TO_OVERRIDE_ERROR_STATUS); |
255 return; | 256 return; |
256 } | 257 } |
257 signin_status_ = new_status; | 258 signin_status_ = new_status; |
258 } | 259 } |
259 | 260 |
260 SigninStatusMetricsProvider::ProfilesSigninStatus | 261 SigninStatusMetricsProvider::ProfilesSigninStatus |
261 SigninStatusMetricsProvider::GetSigninStatusForTesting() { | 262 SigninStatusMetricsProvider::GetSigninStatusForTesting() { |
262 return signin_status_; | 263 return signin_status_; |
263 } | 264 } |
OLD | NEW |