Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.cc

Issue 1022233002: [Smart Lock] Add UMA metrics to measure duration of unlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hook into the existing PowerMonitor observer Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/signin/easy_unlock_service_signin_chromeos.h" 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EasyUnlockServiceSignin::UserData::UserData() 89 EasyUnlockServiceSignin::UserData::UserData()
90 : state(EasyUnlockServiceSignin::USER_DATA_STATE_INITIAL) { 90 : state(EasyUnlockServiceSignin::USER_DATA_STATE_INITIAL) {
91 } 91 }
92 92
93 EasyUnlockServiceSignin::UserData::~UserData() {} 93 EasyUnlockServiceSignin::UserData::~UserData() {}
94 94
95 EasyUnlockServiceSignin::EasyUnlockServiceSignin(Profile* profile) 95 EasyUnlockServiceSignin::EasyUnlockServiceSignin(Profile* profile)
96 : EasyUnlockService(profile), 96 : EasyUnlockService(profile),
97 allow_cryptohome_backoff_(true), 97 allow_cryptohome_backoff_(true),
98 service_active_(false), 98 service_active_(false),
99 user_pod_last_focused_timestamp_(base::TimeTicks::Now()),
99 weak_ptr_factory_(this) { 100 weak_ptr_factory_(this) {
100 } 101 }
101 102
102 EasyUnlockServiceSignin::~EasyUnlockServiceSignin() { 103 EasyUnlockServiceSignin::~EasyUnlockServiceSignin() {
103 } 104 }
104 105
105 void EasyUnlockServiceSignin::SetCurrentUser(const std::string& user_id) { 106 void EasyUnlockServiceSignin::SetCurrentUser(const std::string& user_id) {
106 OnFocusedUserChanged(user_id); 107 OnFocusedUserChanged(user_id);
107 } 108 }
108 109
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return data->devices[device_index].wrapped_secret; 175 return data->devices[device_index].wrapped_secret;
175 } 176 }
176 177
177 void EasyUnlockServiceSignin::RecordEasySignInOutcome( 178 void EasyUnlockServiceSignin::RecordEasySignInOutcome(
178 const std::string& user_id, 179 const std::string& user_id,
179 bool success) const { 180 bool success) const {
180 DCHECK_EQ(GetUserEmail(), user_id); 181 DCHECK_EQ(GetUserEmail(), user_id);
181 182
182 RecordEasyUnlockSigninEvent( 183 RecordEasyUnlockSigninEvent(
183 success ? EASY_UNLOCK_SUCCESS : EASY_UNLOCK_FAILURE); 184 success ? EASY_UNLOCK_SUCCESS : EASY_UNLOCK_FAILURE);
185 if (success) {
186 RecordEasyUnlockSigninDuration(
187 base::TimeTicks::Now() - user_pod_last_focused_timestamp_);
188 }
184 DVLOG(1) << "Easy sign-in " << (success ? "success" : "failure"); 189 DVLOG(1) << "Easy sign-in " << (success ? "success" : "failure");
185 } 190 }
186 191
187 void EasyUnlockServiceSignin::RecordPasswordLoginEvent( 192 void EasyUnlockServiceSignin::RecordPasswordLoginEvent(
188 const std::string& user_id) const { 193 const std::string& user_id) const {
189 // This happens during tests, where a user could log in without the user pod 194 // This happens during tests, where a user could log in without the user pod
190 // being focused. 195 // being focused.
191 if (GetUserEmail() != user_id) 196 if (GetUserEmail() != user_id)
192 return; 197 return;
193 198
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 !user_id_.empty() && 245 !user_id_.empty() &&
241 !chromeos::LoginState::Get()->IsUserLoggedIn(); 246 !chromeos::LoginState::Get()->IsUserLoggedIn();
242 } 247 }
243 248
244 void EasyUnlockServiceSignin::OnWillFinalizeUnlock(bool success) { 249 void EasyUnlockServiceSignin::OnWillFinalizeUnlock(bool success) {
245 // This code path should only be exercised for the lock screen, not for the 250 // This code path should only be exercised for the lock screen, not for the
246 // sign-in screen. 251 // sign-in screen.
247 NOTREACHED(); 252 NOTREACHED();
248 } 253 }
249 254
255 void EasyUnlockServiceSignin::OnSuspendDone() {
256 // Ignored.
257 }
258
250 void EasyUnlockServiceSignin::OnScreenDidLock( 259 void EasyUnlockServiceSignin::OnScreenDidLock(
251 ScreenlockBridge::LockHandler::ScreenType screen_type) { 260 ScreenlockBridge::LockHandler::ScreenType screen_type) {
252 // In production code, the screen type should always be the signin screen; but 261 // In production code, the screen type should always be the signin screen; but
253 // in tests, the screen type might be different. 262 // in tests, the screen type might be different.
254 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN) 263 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN)
255 return; 264 return;
256 265
257 // Update initial UI is when the account picker on login screen is ready. 266 // Update initial UI is when the account picker on login screen is ready.
258 ShowInitialUserState(); 267 ShowInitialUserState();
268 user_pod_last_focused_timestamp_ = base::TimeTicks::Now();
259 } 269 }
260 270
261 void EasyUnlockServiceSignin::OnScreenDidUnlock( 271 void EasyUnlockServiceSignin::OnScreenDidUnlock(
262 ScreenlockBridge::LockHandler::ScreenType screen_type) { 272 ScreenlockBridge::LockHandler::ScreenType screen_type) {
263 // In production code, the screen type should always be the signin screen; but 273 // In production code, the screen type should always be the signin screen; but
264 // in tests, the screen type might be different. 274 // in tests, the screen type might be different.
265 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN) 275 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN)
266 return; 276 return;
267 277
268 DisableAppWithoutResettingScreenlockState(); 278 DisableAppWithoutResettingScreenlockState();
269 279
270 Shutdown(); 280 Shutdown();
271 } 281 }
272 282
273 void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) { 283 void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) {
274 if (user_id_ == user_id) 284 if (user_id_ == user_id)
275 return; 285 return;
276 286
277 // Setting or clearing the user_id may changed |IsAllowed| value, so in these 287 // Setting or clearing the user_id may changed |IsAllowed| value, so in these
278 // cases update the app state. Otherwise, it's enough to notify the app the 288 // cases update the app state. Otherwise, it's enough to notify the app the
279 // user data has been updated. 289 // user data has been updated.
280 bool should_update_app_state = user_id_.empty() != user_id.empty(); 290 bool should_update_app_state = user_id_.empty() != user_id.empty();
281 user_id_ = user_id; 291 user_id_ = user_id;
292 user_pod_last_focused_timestamp_ = base::TimeTicks::Now();
282 293
283 ResetScreenlockState(); 294 ResetScreenlockState();
284 ShowInitialUserState(); 295 ShowInitialUserState();
285 296
286 if (should_update_app_state) { 297 if (should_update_app_state) {
287 UpdateAppState(); 298 UpdateAppState();
288 } else { 299 } else {
289 NotifyUserUpdated(); 300 NotifyUserUpdated();
290 } 301 }
291 302
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return NULL; 382 return NULL;
372 383
373 std::map<std::string, UserData*>::const_iterator it = 384 std::map<std::string, UserData*>::const_iterator it =
374 user_data_.find(user_id_); 385 user_data_.find(user_id_);
375 if (it == user_data_.end()) 386 if (it == user_data_.end())
376 return NULL; 387 return NULL;
377 if (it->second->state != USER_DATA_STATE_LOADED) 388 if (it->second->state != USER_DATA_STATE_LOADED)
378 return NULL; 389 return NULL;
379 return it->second; 390 return it->second;
380 } 391 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_signin_chromeos.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698