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

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 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 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..90685012ff5043b465ec824266db7d4dfa73a3c6 100644
--- a/components/proximity_auth/proximity_auth_pref_manager.cc
+++ b/components/proximity_auth/proximity_auth_pref_manager.cc
@@ -9,6 +9,8 @@
#include "base/macros.h"
#include "base/values.h"
+#include "chrome/common/pref_names.h"
Tim Song 2017/07/11 23:45:57 We shouldn't depend on anything from chrome/.
sacomoto 2017/07/12 15:52:52 Done.
+#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
@@ -27,6 +29,9 @@ void ProximityAuthPrefManager::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterInt64Pref(prefs::kProximityAuthLastPasswordEntryTimestampMs,
0L);
registry->RegisterDictionaryPref(prefs::kProximityAuthRemoteBleDevices);
+ registry->RegisterIntegerPref(
+ ::prefs::kEasyUnlockProximityThreshold, 1,
Tim Song 2017/07/11 23:45:57 Move this to proximity_auth_pref_names in the comp
sacomoto 2017/07/12 15:52:53 Done.
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
}
bool ProximityAuthPrefManager::HasDeviceWithAddress(
@@ -121,4 +126,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