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

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

Issue 628193003: [Easy Unlock] Update handling of the trial easy unlock/signin run (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/common/pref_names.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 e4408a1b471359dfe37029a2440dafcdd41b02ff..10d2a20aa40bff0ec220f26a389e116bd3f093bb 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -187,19 +187,25 @@ void EasyUnlockService::RegisterProfilePrefs(
// static
void EasyUnlockService::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kEasyUnlockFirstRunComplete);
registry->RegisterDictionaryPref(prefs::kEasyUnlockHardlockState);
}
// static
-void EasyUnlockService::RemoveHardlockStateForUser(const std::string& user_id) {
+void EasyUnlockService::ResetLocalStateForUser(const std::string& user_id) {
DCHECK(!user_id.empty());
PrefService* local_state = GetLocalState();
if (!local_state)
return;
- DictionaryPrefUpdate update(local_state, prefs::kEasyUnlockHardlockState);
- update->RemoveWithoutPathExpansion(user_id, NULL);
+ DictionaryPrefUpdate hardlock_update(local_state,
+ prefs::kEasyUnlockHardlockState);
+ hardlock_update->RemoveWithoutPathExpansion(user_id, NULL);
+
+ DictionaryPrefUpdate first_run_update(local_state,
+ prefs::kEasyUnlockFirstRunComplete);
+ first_run_update->RemoveWithoutPathExpansion(user_id, NULL);
}
bool EasyUnlockService::IsAllowed() {
@@ -260,10 +266,13 @@ EasyUnlockScreenlockStateHandler*
if (!IsAllowed())
return NULL;
if (!screenlock_state_handler_) {
+ std::string user_id = GetUserEmail();
+ if (GetType() == TYPE_REGULAR)
+ MaybeMigrateShowTutorialPref(user_id);
screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler(
- GetUserEmail(),
+ user_id,
GetHardlockState(),
- GetType() == TYPE_REGULAR ? profile_->GetPrefs() : NULL,
+ GetLocalState(),
ScreenlockBridge::Get()));
}
return screenlock_state_handler_.get();
@@ -521,6 +530,21 @@ void EasyUnlockService::SetHardlockStateForUser(
SetScreenlockHardlockedState(state);
}
+void EasyUnlockService::MaybeMigrateShowTutorialPref(
+ const std::string& user_id) {
+ DCHECK_EQ(TYPE_REGULAR, GetType());
+
+ PrefService* local_state = GetLocalState();
+ // The default value for kEasyUnlockShowTutorial pref is true.
+ if (user_id.empty() || !local_state ||
+ profile_->GetPrefs()->GetBoolean(prefs::kEasyUnlockShowTutorial))
+ return;
+ profile_->GetPrefs()->SetBoolean(prefs::kEasyUnlockShowTutorial, true);
xiyuan 2014/10/08 19:57:25 nit: How about ClearPref() here?
tbarzic 2014/10/09 02:43:24 Done.
+
+ DictionaryPrefUpdate update(local_state, prefs::kEasyUnlockFirstRunComplete);
+ update->SetBooleanWithoutPathExpansion(user_id, true);
+}
+
#if defined(OS_CHROMEOS)
void EasyUnlockService::OnCryptohomeKeysFetchedForChecking(
const std::string& user_id,
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698