Index: chrome/browser/chromeos/login/session/user_session_manager.cc |
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc |
index 144124db0d8cdd3d1010d044503197a26b375327..7b5a123d4aa6c627be3a5bbfad9f6f1884a43ec6 100644 |
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc |
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc |
@@ -26,6 +26,7 @@ |
#include "chrome/browser/chromeos/boot_times_loader.h" |
#include "chrome/browser/chromeos/input_method/input_method_util.h" |
#include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" |
#include "chrome/browser/chromeos/login/profile_auth_data.h" |
#include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" |
#include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory.h" |
@@ -44,6 +45,7 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/rlz/rlz.h" |
+#include "chrome/browser/signin/easy_unlock_service.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/logging_chrome.h" |
@@ -792,6 +794,8 @@ void UserSessionManager::FinalizePrepareProfile(Profile* profile) { |
// resolved. |
if (delegate_) |
delegate_->OnProfilePrepared(profile); |
+ |
+ UpdateEasyUnlockKeys(profile); |
} |
void UserSessionManager::InitSessionRestoreStrategy() { |
@@ -991,6 +995,30 @@ void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
PendingUserSessionsRestoreFinished()); |
} |
+void UserSessionManager::UpdateEasyUnlockKeys(Profile* user_profile) { |
+ if (!CommandLine::ForCurrentProcess() |
+ ->HasSwitch(chromeos::switches::kEnableEasySignin)) { |
+ return; |
+ } |
+ |
+ easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
+ |
+ const base::ListValue* device_list = NULL; |
+ if (EasyUnlockService::Get(user_profile)) |
+ device_list = EasyUnlockService::Get(user_profile)->GetRemoteDevices(); |
+ |
+ if (device_list) { |
+ easy_unlock_key_manager_->CreateKeys( |
+ user_context_, |
+ *device_list, |
+ EasyUnlockKeyManager::CreateKeysCallback()); |
+ } else { |
+ easy_unlock_key_manager_->RemoveKeys( |
+ user_context_, |
+ EasyUnlockKeyManager::RemoveKeysCallback()); |
+ } |
+} |
+ |
void UserSessionManager::ActiveUserChanged( |
const user_manager::User* active_user) { |
Profile* profile = ProfileHelper::Get()->GetProfileByUser(active_user); |