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

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: update histograms.xml 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
« no previous file with comments | « chrome/browser/chromeos/login/session/user_session_manager.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32777b4e485f28cb114e39cc2f3cab9cf6c6c6b5..00ca0aee23ee0af1f1c95294d3847ca0c8f4aa70 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,34 @@ void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() {
PendingUserSessionsRestoreFinished());
}
+void UserSessionManager::UpdateEasyUnlockKeys(Profile* user_profile) {
+ if (!GetEasyUnlockKeyManager())
+ return;
+
+ // Only update Easy unlock keys for regular user.
+ if (user_context_.GetUserType() != user_manager::USER_TYPE_REGULAR)
+ return;
+
+ // |user_context_| and |user_profile| must belong to the same user.
+ DCHECK_EQ(SigninManagerFactory::GetForProfile(user_profile)
+ ->GetAuthenticatedAccountId(),
+ user_context_.GetUserID());
+
+ 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_,
+ *device_list,
+ EasyUnlockKeyManager::RefreshKeysCallback());
+ } 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 +1048,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
« no previous file with comments | « chrome/browser/chromeos/login/session/user_session_manager.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698