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

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

Issue 446743003: Hook up new API for easy unlock to update lock screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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/screenlock_bridge.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 1afcbc9e128e45c78b357f083d75025b091eac08..ea74acb3e2025b2e697e429030c556048c6b8acb 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -13,7 +13,9 @@
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
#include "chrome/browser/signin/easy_unlock_service_factory.h"
+#include "chrome/browser/signin/screenlock_bridge.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -45,7 +47,8 @@ EasyUnlockService* EasyUnlockService::Get(Profile* profile) {
}
EasyUnlockService::EasyUnlockService(Profile* profile)
- : profile_(profile), weak_ptr_factory_(this) {
+ : profile_(profile),
+ weak_ptr_factory_(this) {
extensions::ExtensionSystem::Get(profile_)->ready().Post(
FROM_HERE,
base::Bind(&EasyUnlockService::Initialize,
@@ -88,7 +91,7 @@ void EasyUnlockService::LaunchSetup() {
bool EasyUnlockService::IsAllowed() {
#if defined(OS_CHROMEOS)
- if (chromeos::UserManager::Get()->IsLoggedInAsGuest())
+ if (!chromeos::UserManager::Get()->IsLoggedInAsRegularUser())
return false;
if (!chromeos::ProfileHelper::IsPrimaryProfile(profile_))
@@ -105,6 +108,12 @@ bool EasyUnlockService::IsAllowed() {
#endif
}
+
+EasyUnlockScreenlockStateHandler*
+ EasyUnlockService::GetScreenlockStateHandler() {
+ return screenlock_state_handler_.get();
+}
+
void EasyUnlockService::Initialize() {
registrar_.Init(profile_->GetPrefs());
registrar_.Add(
@@ -113,7 +122,7 @@ void EasyUnlockService::Initialize() {
OnPrefsChanged();
}
-void EasyUnlockService::LoadApp() {
+bool EasyUnlockService::LoadApp() {
DCHECK(IsAllowed());
#if defined(GOOGLE_CHROME_BUILD)
@@ -132,10 +141,13 @@ void EasyUnlockService::LoadApp() {
#endif // !defined(NDEBUG)
if (!easy_unlock_path.empty()) {
- GetComponentLoader(profile_)
+ std::string id = GetComponentLoader(profile_)
->Add(IDR_EASY_UNLOCK_MANIFEST, easy_unlock_path);
+ return !id.empty();
}
#endif // defined(GOOGLE_CHROME_BUILD)
+
+ return false;
}
void EasyUnlockService::UnloadApp() {
@@ -143,8 +155,16 @@ void EasyUnlockService::UnloadApp() {
}
void EasyUnlockService::OnPrefsChanged() {
- if (IsAllowed())
- LoadApp();
- else
+ if (IsAllowed()) {
+ if (LoadApp()) {
+ // If the app is loaded, set up screenlock_state_handler_.
+ screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler(
+ ScreenlockBridge::GetAuthenticatedUserEmail(profile_),
xiyuan 2014/08/12 21:51:49 I would prefer to what we have in PS24, where |scr
tbarzic 2014/08/12 22:12:52 ok, reverting this back. I'll keep reset before Un
xiyuan 2014/08/12 22:14:39 Sounds good.
+ profile_->GetPrefs(),
+ ScreenlockBridge::Get()));
+ }
+ } else {
+ screenlock_state_handler_.reset();
UnloadApp();
+ }
}
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/browser/signin/screenlock_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698