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

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

Issue 2973243002: Adding pref to store the user-selected proximity threshold. (Closed)
Patch Set: Fixing browser tests Created 3 years, 5 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 void EasyUnlockServiceRegular::InitializeInternal() { 443 void EasyUnlockServiceRegular::InitializeInternal() {
444 proximity_auth::ScreenlockBridge::Get()->AddObserver(this); 444 proximity_auth::ScreenlockBridge::Get()->AddObserver(this);
445 registrar_.Init(profile()->GetPrefs()); 445 registrar_.Init(profile()->GetPrefs());
446 registrar_.Add( 446 registrar_.Add(
447 prefs::kEasyUnlockAllowed, 447 prefs::kEasyUnlockAllowed,
448 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, 448 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
449 base::Unretained(this))); 449 base::Unretained(this)));
450 registrar_.Add(prefs::kEasyUnlockProximityRequired, 450 registrar_.Add(prefs::kEasyUnlockProximityRequired,
451 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, 451 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
452 base::Unretained(this))); 452 base::Unretained(this)));
453 registrar_.Add(prefs::kEasyUnlockProximityThreshold,
454 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
455 base::Unretained(this)));
453 456
454 OnPrefsChanged(); 457 OnPrefsChanged();
455 458
456 #if defined(OS_CHROMEOS) 459 #if defined(OS_CHROMEOS)
457 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 460 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
458 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) { 461 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) {
459 pref_manager_.reset( 462 pref_manager_.reset(
460 new proximity_auth::ProximityAuthPrefManager(profile()->GetPrefs())); 463 new proximity_auth::ProximityAuthPrefManager(profile()->GetPrefs()));
461 GetCryptAuthDeviceManager()->AddObserver(this); 464 GetCryptAuthDeviceManager()->AddObserver(this);
462 LoadRemoteDevices(); 465 LoadRemoteDevices();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 if (!local_state || !profile_prefs) 610 if (!local_state || !profile_prefs)
608 return; 611 return;
609 612
610 // Create the dictionary of Easy Unlock preferences for the current user. The 613 // Create the dictionary of Easy Unlock preferences for the current user. The
611 // items in the dictionary are the same profile prefs used for Easy Unlock. 614 // items in the dictionary are the same profile prefs used for Easy Unlock.
612 std::unique_ptr<base::DictionaryValue> user_prefs_dict( 615 std::unique_ptr<base::DictionaryValue> user_prefs_dict(
613 new base::DictionaryValue()); 616 new base::DictionaryValue());
614 user_prefs_dict->SetBooleanWithoutPathExpansion( 617 user_prefs_dict->SetBooleanWithoutPathExpansion(
615 prefs::kEasyUnlockProximityRequired, 618 prefs::kEasyUnlockProximityRequired,
616 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); 619 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired));
620 user_prefs_dict->SetIntegerWithoutPathExpansion(
621 prefs::kEasyUnlockProximityThreshold,
622 profile_prefs->GetInteger(prefs::kEasyUnlockProximityThreshold));
617 623
618 DictionaryPrefUpdate update(local_state, 624 DictionaryPrefUpdate update(local_state,
619 prefs::kEasyUnlockLocalStateUserPrefs); 625 prefs::kEasyUnlockLocalStateUserPrefs);
620 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(), 626 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(),
621 std::move(user_prefs_dict)); 627 std::move(user_prefs_dict));
622 } 628 }
623 629
624 cryptauth::CryptAuthEnrollmentManager* 630 cryptauth::CryptAuthEnrollmentManager*
625 EasyUnlockServiceRegular::GetCryptAuthEnrollmentManager() { 631 EasyUnlockServiceRegular::GetCryptAuthEnrollmentManager() {
626 cryptauth::CryptAuthEnrollmentManager* manager = 632 cryptauth::CryptAuthEnrollmentManager* manager =
627 ChromeCryptAuthServiceFactory::GetInstance() 633 ChromeCryptAuthServiceFactory::GetInstance()
628 ->GetForBrowserContext(profile()) 634 ->GetForBrowserContext(profile())
629 ->GetCryptAuthEnrollmentManager(); 635 ->GetCryptAuthEnrollmentManager();
630 DCHECK(manager); 636 DCHECK(manager);
631 return manager; 637 return manager;
632 } 638 }
633 639
634 cryptauth::CryptAuthDeviceManager* 640 cryptauth::CryptAuthDeviceManager*
635 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() { 641 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() {
636 cryptauth::CryptAuthDeviceManager* manager = 642 cryptauth::CryptAuthDeviceManager* manager =
637 ChromeCryptAuthServiceFactory::GetInstance() 643 ChromeCryptAuthServiceFactory::GetInstance()
638 ->GetForBrowserContext(profile()) 644 ->GetForBrowserContext(profile())
639 ->GetCryptAuthDeviceManager(); 645 ->GetCryptAuthDeviceManager();
640 DCHECK(manager); 646 DCHECK(manager);
641 return manager; 647 return manager;
642 } 648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698