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

Unified Diff: chrome/browser/signin/easy_unlock_service.cc

Issue 880603003: Copy Smart Lock user preferences to local state so we can access them on the sign-in screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change name to requireCloseProximity Created 5 years, 11 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
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/browser/signin/easy_unlock_service_regular.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/easy_unlock_service.cc
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc
index 2473c8d6d47fa95a65ec1642854f53524cc2bfbb..ed1b8b07fa6bc07f5c5bef0424d266619871a952 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -65,6 +65,13 @@ PrefService* GetLocalState() {
} // namespace
+EasyUnlockService::UserSettings::UserSettings()
+ : require_close_proximity(false) {
+}
+
+EasyUnlockService::UserSettings::~UserSettings() {
+}
+
// static
EasyUnlockService* EasyUnlockService::Get(Profile* profile) {
return EasyUnlockServiceFactory::GetForProfile(profile);
@@ -233,6 +240,7 @@ void EasyUnlockService::RegisterProfilePrefs(
// static
void EasyUnlockService::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kEasyUnlockLocalStateUserPrefs);
registry->RegisterDictionaryPref(prefs::kEasyUnlockHardlockState);
#if defined(OS_CHROMEOS)
EasyUnlockTpmKeyManager::RegisterLocalStatePrefs(registry);
@@ -255,6 +263,33 @@ void EasyUnlockService::ResetLocalStateForUser(const std::string& user_id) {
#endif
}
+// static
+EasyUnlockService::UserSettings EasyUnlockService::GetUserSettings(
+ const std::string& user_id) {
+ DCHECK(!user_id.empty());
+ UserSettings user_settings;
+
+ PrefService* local_state = GetLocalState();
+ if (!local_state)
+ return user_settings;
+
+ const base::DictionaryValue* all_user_prefs_dict =
+ local_state->GetDictionary(prefs::kEasyUnlockLocalStateUserPrefs);
+ if (!all_user_prefs_dict)
+ return user_settings;
+
+ const base::DictionaryValue* user_prefs_dict;
+ if (!all_user_prefs_dict->GetDictionaryWithoutPathExpansion(user_id,
+ &user_prefs_dict))
+ return user_settings;
+
+ user_prefs_dict->GetBooleanWithoutPathExpansion(
+ prefs::kEasyUnlockProximityRequired,
+ &user_settings.require_close_proximity);
+
+ return user_settings;
+}
+
bool EasyUnlockService::IsAllowed() {
if (shut_down_)
return false;
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/browser/signin/easy_unlock_service_regular.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698