OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/login/oauth2_login_manager.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (token_service->AreCredentialsValid()) | 209 if (token_service->AreCredentialsValid()) |
210 token_service->StartFetchingTokens(); | 210 token_service->StartFetchingTokens(); |
211 } | 211 } |
212 | 212 |
213 void OAuth2LoginManager::SetSessionRestoreState( | 213 void OAuth2LoginManager::SetSessionRestoreState( |
214 OAuth2LoginManager::SessionRestoreState state) { | 214 OAuth2LoginManager::SessionRestoreState state) { |
215 if (state_ == state) | 215 if (state_ == state) |
216 return; | 216 return; |
217 | 217 |
218 state_ = state; | 218 state_ = state; |
| 219 if (state == OAuth2LoginManager::SESSION_RESTORE_FAILED) { |
| 220 UMA_HISTOGRAM_TIMES("OAuth2Login.SessionRestoreTimeToFailure", |
| 221 base::Time::Now() - session_restore_start_); |
| 222 } else if (state == OAuth2LoginManager::SESSION_RESTORE_DONE) { |
| 223 UMA_HISTOGRAM_TIMES("OAuth2Login.SessionRestoreTimeToSuccess", |
| 224 base::Time::Now() - session_restore_start_); |
| 225 } |
| 226 |
219 FOR_EACH_OBSERVER(Observer, observer_list_, | 227 FOR_EACH_OBSERVER(Observer, observer_list_, |
220 OnSessionRestoreStateChanged(user_profile_, state_)); | 228 OnSessionRestoreStateChanged(user_profile_, state_)); |
221 } | 229 } |
222 | 230 |
223 void OAuth2LoginManager::SetSessionRestoreStartForTesting( | 231 void OAuth2LoginManager::SetSessionRestoreStartForTesting( |
224 const base::Time& time) { | 232 const base::Time& time) { |
225 session_restore_start_ = time; | 233 session_restore_start_ = time; |
226 } | 234 } |
227 | 235 |
228 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |