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

Unified Diff: components/proximity_auth/proximity_auth_pref_manager.cc

Issue 2973243002: Adding pref to store the user-selected proximity threshold. (Closed)
Patch Set: Fixing merge 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 side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/proximity_auth_pref_manager.cc
diff --git a/components/proximity_auth/proximity_auth_pref_manager.cc b/components/proximity_auth/proximity_auth_pref_manager.cc
index c8c637c0cf2b8869ce7a8c40e334d6f952b7801a..39101cbeae5c875ec8e9f06f723d9768d76fe419 100644
--- a/components/proximity_auth/proximity_auth_pref_manager.cc
+++ b/components/proximity_auth/proximity_auth_pref_manager.cc
@@ -9,7 +9,7 @@
#include "base/macros.h"
#include "base/values.h"
-#include "components/prefs/pref_registry_simple.h"
+#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/proximity_auth/logging/logging.h"
@@ -23,10 +23,14 @@ ProximityAuthPrefManager::ProximityAuthPrefManager(PrefService* pref_service)
ProximityAuthPrefManager::~ProximityAuthPrefManager() {}
// static
-void ProximityAuthPrefManager::RegisterPrefs(PrefRegistrySimple* registry) {
+void ProximityAuthPrefManager::RegisterPrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterInt64Pref(prefs::kProximityAuthLastPasswordEntryTimestampMs,
0L);
registry->RegisterDictionaryPref(prefs::kProximityAuthRemoteBleDevices);
+ registry->RegisterIntegerPref(
+ prefs::kEasyUnlockProximityThreshold, 1,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
}
bool ProximityAuthPrefManager::HasDeviceWithAddress(
@@ -121,4 +125,15 @@ const base::DictionaryValue* ProximityAuthPrefManager::GetRemoteBleDevices()
return pref_service_->GetDictionary(prefs::kProximityAuthRemoteBleDevices);
}
+void ProximityAuthPrefManager::SetProximityThreshold(ProximityThreshold value) {
+ pref_service_->SetInteger(prefs::kEasyUnlockProximityThreshold, value);
+}
+
+ProximityAuthPrefManager::ProximityThreshold
+ProximityAuthPrefManager::GetProximityThreshold() const {
+ int pref_value =
+ pref_service_->GetInteger(prefs::kEasyUnlockProximityThreshold);
+ return static_cast<ProximityThreshold>(pref_value);
+}
+
} // namespace proximity_auth

Powered by Google App Engine
This is Rietveld 408576698