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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 554043003: cros: Create cryptohome keys for Easy sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: support multiple get key op, create key first then trim extra, lazily create manager Created 6 years, 3 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: 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..3cdfeed2590b709165f396e71d4677782dfe3bcd 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,25 @@ void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() {
PendingUserSessionsRestoreFinished());
}
+void UserSessionManager::UpdateEasyUnlockKeys(Profile* user_profile) {
+ if (!GetEasyUnlockKeyManager())
+ return;
+
+ 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_->RefreshKeys(
+ user_context_,
tbarzic 2014/09/10 19:01:11 do we have to check that user_context_ and user_pr
xiyuan 2014/09/10 20:37:13 The two should match. But to be safe, added a DCHE
+ *device_list,
tbarzic 2014/09/10 19:01:11 suggestion: you could make EasyUnlockKeyManager::R
xiyuan 2014/09/10 20:37:13 Cannot do this because the ? trinary expression in
+ EasyUnlockKeyManager::CreateKeysCallback());
+ } else {
+ easy_unlock_key_manager_->RemoveKeys(
+ user_context_, 0, EasyUnlockKeyManager::RemoveKeysCallback());
+ }
+}
+
void UserSessionManager::ActiveUserChanged(
const user_manager::User* active_user) {
Profile* profile = ProfileHelper::Get()->GetProfileByUser(active_user);
@@ -1016,4 +1039,16 @@ UserSessionManager::GetDefaultIMEState(Profile* profile) {
return state;
}
+EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() {
+ if (!CommandLine::ForCurrentProcess()
+ ->HasSwitch(chromeos::switches::kEnableEasySignin)) {
+ return NULL;
+ }
+
+ if (!easy_unlock_key_manager_)
+ easy_unlock_key_manager_.reset(new EasyUnlockKeyManager);
+
+ return easy_unlock_key_manager_.get();
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698