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

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: Addressing DEPS issues 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 23 matching lines...) Expand all
34 #include "components/cryptauth/cryptauth_enrollment_utils.h" 34 #include "components/cryptauth/cryptauth_enrollment_utils.h"
35 #include "components/cryptauth/cryptauth_gcm_manager_impl.h" 35 #include "components/cryptauth/cryptauth_gcm_manager_impl.h"
36 #include "components/cryptauth/remote_device_loader.h" 36 #include "components/cryptauth/remote_device_loader.h"
37 #include "components/cryptauth/secure_message_delegate.h" 37 #include "components/cryptauth/secure_message_delegate.h"
38 #include "components/gcm_driver/gcm_profile_service.h" 38 #include "components/gcm_driver/gcm_profile_service.h"
39 #include "components/pref_registry/pref_registry_syncable.h" 39 #include "components/pref_registry/pref_registry_syncable.h"
40 #include "components/prefs/pref_service.h" 40 #include "components/prefs/pref_service.h"
41 #include "components/prefs/scoped_user_pref_update.h" 41 #include "components/prefs/scoped_user_pref_update.h"
42 #include "components/proximity_auth/logging/logging.h" 42 #include "components/proximity_auth/logging/logging.h"
43 #include "components/proximity_auth/proximity_auth_pref_manager.h" 43 #include "components/proximity_auth/proximity_auth_pref_manager.h"
44 #include "components/proximity_auth/proximity_auth_pref_names.h"
44 #include "components/proximity_auth/proximity_auth_system.h" 45 #include "components/proximity_auth/proximity_auth_system.h"
45 #include "components/proximity_auth/screenlock_bridge.h" 46 #include "components/proximity_auth/screenlock_bridge.h"
46 #include "components/proximity_auth/switches.h" 47 #include "components/proximity_auth/switches.h"
47 #include "components/signin/core/browser/profile_oauth2_token_service.h" 48 #include "components/signin/core/browser/profile_oauth2_token_service.h"
48 #include "components/signin/core/browser/signin_manager.h" 49 #include "components/signin/core/browser/signin_manager.h"
49 #include "components/translate/core/browser/translate_download_manager.h" 50 #include "components/translate/core/browser/translate_download_manager.h"
50 #include "components/version_info/version_info.h" 51 #include "components/version_info/version_info.h"
51 #include "content/public/browser/browser_thread.h" 52 #include "content/public/browser/browser_thread.h"
52 #include "extensions/browser/event_router.h" 53 #include "extensions/browser/event_router.h"
53 #include "extensions/common/constants.h" 54 #include "extensions/common/constants.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 void EasyUnlockServiceRegular::InitializeInternal() { 444 void EasyUnlockServiceRegular::InitializeInternal() {
444 proximity_auth::ScreenlockBridge::Get()->AddObserver(this); 445 proximity_auth::ScreenlockBridge::Get()->AddObserver(this);
445 registrar_.Init(profile()->GetPrefs()); 446 registrar_.Init(profile()->GetPrefs());
446 registrar_.Add( 447 registrar_.Add(
447 prefs::kEasyUnlockAllowed, 448 prefs::kEasyUnlockAllowed,
448 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, 449 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
449 base::Unretained(this))); 450 base::Unretained(this)));
450 registrar_.Add(prefs::kEasyUnlockProximityRequired, 451 registrar_.Add(prefs::kEasyUnlockProximityRequired,
451 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, 452 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
452 base::Unretained(this))); 453 base::Unretained(this)));
454 registrar_.Add(proximity_auth::prefs::kEasyUnlockProximityThreshold,
455 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged,
456 base::Unretained(this)));
453 457
454 OnPrefsChanged(); 458 OnPrefsChanged();
455 459
456 #if defined(OS_CHROMEOS) 460 #if defined(OS_CHROMEOS)
457 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 461 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
458 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) { 462 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) {
459 pref_manager_.reset( 463 pref_manager_.reset(
460 new proximity_auth::ProximityAuthPrefManager(profile()->GetPrefs())); 464 new proximity_auth::ProximityAuthPrefManager(profile()->GetPrefs()));
461 GetCryptAuthDeviceManager()->AddObserver(this); 465 GetCryptAuthDeviceManager()->AddObserver(this);
462 LoadRemoteDevices(); 466 LoadRemoteDevices();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 if (!local_state || !profile_prefs) 611 if (!local_state || !profile_prefs)
608 return; 612 return;
609 613
610 // Create the dictionary of Easy Unlock preferences for the current user. The 614 // 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. 615 // items in the dictionary are the same profile prefs used for Easy Unlock.
612 std::unique_ptr<base::DictionaryValue> user_prefs_dict( 616 std::unique_ptr<base::DictionaryValue> user_prefs_dict(
613 new base::DictionaryValue()); 617 new base::DictionaryValue());
614 user_prefs_dict->SetBooleanWithoutPathExpansion( 618 user_prefs_dict->SetBooleanWithoutPathExpansion(
615 prefs::kEasyUnlockProximityRequired, 619 prefs::kEasyUnlockProximityRequired,
616 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); 620 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired));
621 user_prefs_dict->SetIntegerWithoutPathExpansion(
622 proximity_auth::prefs::kEasyUnlockProximityThreshold,
623 profile_prefs->GetInteger(
624 proximity_auth::prefs::kEasyUnlockProximityThreshold));
617 625
618 DictionaryPrefUpdate update(local_state, 626 DictionaryPrefUpdate update(local_state,
619 prefs::kEasyUnlockLocalStateUserPrefs); 627 prefs::kEasyUnlockLocalStateUserPrefs);
620 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(), 628 update->SetWithoutPathExpansion(GetAccountId().GetUserEmail(),
621 std::move(user_prefs_dict)); 629 std::move(user_prefs_dict));
622 } 630 }
623 631
624 cryptauth::CryptAuthEnrollmentManager* 632 cryptauth::CryptAuthEnrollmentManager*
625 EasyUnlockServiceRegular::GetCryptAuthEnrollmentManager() { 633 EasyUnlockServiceRegular::GetCryptAuthEnrollmentManager() {
626 cryptauth::CryptAuthEnrollmentManager* manager = 634 cryptauth::CryptAuthEnrollmentManager* manager =
627 ChromeCryptAuthServiceFactory::GetInstance() 635 ChromeCryptAuthServiceFactory::GetInstance()
628 ->GetForBrowserContext(profile()) 636 ->GetForBrowserContext(profile())
629 ->GetCryptAuthEnrollmentManager(); 637 ->GetCryptAuthEnrollmentManager();
630 DCHECK(manager); 638 DCHECK(manager);
631 return manager; 639 return manager;
632 } 640 }
633 641
634 cryptauth::CryptAuthDeviceManager* 642 cryptauth::CryptAuthDeviceManager*
635 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() { 643 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() {
636 cryptauth::CryptAuthDeviceManager* manager = 644 cryptauth::CryptAuthDeviceManager* manager =
637 ChromeCryptAuthServiceFactory::GetInstance() 645 ChromeCryptAuthServiceFactory::GetInstance()
638 ->GetForBrowserContext(profile()) 646 ->GetForBrowserContext(profile())
639 ->GetCryptAuthDeviceManager(); 647 ->GetCryptAuthDeviceManager();
640 DCHECK(manager); 648 DCHECK(manager);
641 return manager; 649 return manager;
642 } 650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698