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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.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: Created 5 years, 9 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_regular.h" 5 #include "chrome/browser/signin/easy_unlock_service_regular.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Key name of the remote device list in kEasyUnlockPairing. 46 // Key name of the remote device list in kEasyUnlockPairing.
47 const char kKeyDevices[] = "devices"; 47 const char kKeyDevices[] = "devices";
48 48
49 } // namespace 49 } // namespace
50 50
51 EasyUnlockServiceRegular::EasyUnlockServiceRegular(Profile* profile) 51 EasyUnlockServiceRegular::EasyUnlockServiceRegular(Profile* profile)
52 : EasyUnlockService(profile), 52 : EasyUnlockService(profile),
53 turn_off_flow_status_(EasyUnlockService::IDLE), 53 turn_off_flow_status_(EasyUnlockService::IDLE),
54 will_unlock_using_easy_unlock_(false), 54 will_unlock_using_easy_unlock_(false),
55 lock_screen_last_shown_timestamp_(base::TimeTicks::Now()),
55 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
56 } 57 }
57 58
58 EasyUnlockServiceRegular::~EasyUnlockServiceRegular() { 59 EasyUnlockServiceRegular::~EasyUnlockServiceRegular() {
59 } 60 }
60 61
61 EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const { 62 EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const {
62 return EasyUnlockService::TYPE_REGULAR; 63 return EasyUnlockService::TYPE_REGULAR;
63 } 64 }
64 65
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 #endif 318 #endif
318 } 319 }
319 320
320 void EasyUnlockServiceRegular::OnWillFinalizeUnlock(bool success) { 321 void EasyUnlockServiceRegular::OnWillFinalizeUnlock(bool success) {
321 will_unlock_using_easy_unlock_ = success; 322 will_unlock_using_easy_unlock_ = success;
322 } 323 }
323 324
324 void EasyUnlockServiceRegular::OnScreenDidLock( 325 void EasyUnlockServiceRegular::OnScreenDidLock(
325 ScreenlockBridge::LockHandler::ScreenType screen_type) { 326 ScreenlockBridge::LockHandler::ScreenType screen_type) {
326 will_unlock_using_easy_unlock_ = false; 327 will_unlock_using_easy_unlock_ = false;
328 lock_screen_last_shown_timestamp_ = base::TimeTicks::Now();
327 } 329 }
328 330
329 void EasyUnlockServiceRegular::OnScreenDidUnlock( 331 void EasyUnlockServiceRegular::OnScreenDidUnlock(
330 ScreenlockBridge::LockHandler::ScreenType screen_type) { 332 ScreenlockBridge::LockHandler::ScreenType screen_type) {
331 // Notifications of signin screen unlock events can also reach this code path; 333 // Notifications of signin screen unlock events can also reach this code path;
332 // disregard them. 334 // disregard them.
333 if (screen_type != ScreenlockBridge::LockHandler::LOCK_SCREEN) 335 if (screen_type != ScreenlockBridge::LockHandler::LOCK_SCREEN)
334 return; 336 return;
335 337
336 // Only record metrics for users who have enabled the feature. 338 // Only record metrics for users who have enabled the feature.
337 if (IsEnabled()) { 339 if (IsEnabled()) {
338 EasyUnlockAuthEvent event = 340 EasyUnlockAuthEvent event =
339 will_unlock_using_easy_unlock_ 341 will_unlock_using_easy_unlock_
340 ? EASY_UNLOCK_SUCCESS 342 ? EASY_UNLOCK_SUCCESS
341 : GetPasswordAuthEvent(); 343 : GetPasswordAuthEvent();
342 RecordEasyUnlockScreenUnlockEvent(event); 344 RecordEasyUnlockScreenUnlockEvent(event);
345
346 if (will_unlock_using_easy_unlock_) {
347 RecordEasyUnlockScreenUnlockDuration(
348 base::TimeTicks::Now() - lock_screen_last_shown_timestamp_);
349 }
343 } 350 }
344 351
345 will_unlock_using_easy_unlock_ = false; 352 will_unlock_using_easy_unlock_ = false;
346 } 353 }
347 354
348 void EasyUnlockServiceRegular::OnFocusedUserChanged( 355 void EasyUnlockServiceRegular::OnFocusedUserChanged(
349 const std::string& user_id) { 356 const std::string& user_id) {
350 // Nothing to do. 357 // Nothing to do.
351 } 358 }
352 359
360 #if defined(OS_CHROMEOS)
361 void EasyUnlockServiceRegular::SuspendDone(
362 const base::TimeDelta& sleep_duration) {
363 lock_screen_last_shown_timestamp_ = base::TimeTicks::Now();
364 }
365 #endif // defined(OS_CHROMEOS)
366
353 void EasyUnlockServiceRegular::OnPrefsChanged() { 367 void EasyUnlockServiceRegular::OnPrefsChanged() {
354 SyncProfilePrefsToLocalState(); 368 SyncProfilePrefsToLocalState();
355 UpdateAppState(); 369 UpdateAppState();
356 } 370 }
357 371
358 void EasyUnlockServiceRegular::SetTurnOffFlowStatus(TurnOffFlowStatus status) { 372 void EasyUnlockServiceRegular::SetTurnOffFlowStatus(TurnOffFlowStatus status) {
359 turn_off_flow_status_ = status; 373 turn_off_flow_status_ = status;
360 NotifyTurnOffOperationStatusChanged(); 374 NotifyTurnOffOperationStatusChanged();
361 } 375 }
362 376
(...skipping 25 matching lines...) Expand all
388 new base::DictionaryValue()); 402 new base::DictionaryValue());
389 user_prefs_dict->SetBooleanWithoutPathExpansion( 403 user_prefs_dict->SetBooleanWithoutPathExpansion(
390 prefs::kEasyUnlockProximityRequired, 404 prefs::kEasyUnlockProximityRequired,
391 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); 405 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired));
392 406
393 DictionaryPrefUpdate update(local_state, 407 DictionaryPrefUpdate update(local_state,
394 prefs::kEasyUnlockLocalStateUserPrefs); 408 prefs::kEasyUnlockLocalStateUserPrefs);
395 std::string user_email = GetUserEmail(); 409 std::string user_email = GetUserEmail();
396 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); 410 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass());
397 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698