Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| index 6415cd98297d4df492bf3106585f531116fbf4ad..acbaa902e7dce821763becf8d6b8edad79a920a5 100644 |
| --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| @@ -43,9 +43,9 @@ |
| #include "chrome/browser/chromeos/policy/device_local_account.h" |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| -#include "chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h" |
| #include "chrome/browser/io_thread.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/signin/easy_unlock_service.h" |
| #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retriever.h" |
| #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
| #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| @@ -983,6 +983,25 @@ void SigninScreenHandler::Unlock(const std::string& user_email) { |
| ScreenLocker::Hide(); |
| } |
| +void SigninScreenHandler::AttemptUserClickLogin(const std::string& user_email, |
| + const std::string& secret, |
| + const std::string& key_label) { |
| + DCHECK(!ScreenLocker::default_screen_locker()); |
| + if (!delegate_) |
| + return; |
| + |
| + UserContext user_context(user_email); |
| + user_context.SetAuthFlow(UserContext::AUTH_FLOW_EASY_UNLOCK); |
| + user_context.SetKey(Key(secret)); |
| + user_context.GetKey()->SetLabel(key_label); |
| + |
| + // TODO(tbarzic): Handle empty secret. The delegate will end up ignoring login |
| + // attempt if the key is not set, and the UI will remain disabled. |
| + DCHECK(!secret.empty()); |
| + |
| + delegate_->Login(user_context, SigninSpecifics()); |
|
Tim Song
2014/09/23 19:37:59
Is the delegate hooked up yet for logging in with
xiyuan
2014/09/23 19:56:58
The delegate should be set when sign-in screen is
tbarzic
2014/09/23 19:58:35
Yeah, it should work fine.
|
| +} |
| + |
| void SigninScreenHandler::OnMaximizeModeStarted() { |
| CallJS("login.AccountPickerScreen.setTouchViewState", true); |
| } |
| @@ -1051,7 +1070,11 @@ void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, |
| } |
| void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { |
| - DCHECK(ScreenLocker::default_screen_locker()); |
| + if (!ScreenLocker::default_screen_locker()) { |
| + OobeUI* oobe_ui = static_cast<OobeUI*>(web_ui()->GetController()); |
| + if (oobe_ui->display_type() != OobeUI::kLoginDisplay) |
| + return; |
| + } |
| const user_manager::User* unlock_user = NULL; |
| const user_manager::UserList& users = delegate_->GetUsers(); |
| @@ -1066,11 +1089,16 @@ void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { |
| if (!unlock_user) |
| return; |
| - Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(unlock_user); |
| - extensions::ScreenlockPrivateEventRouter* router = |
| - extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( |
| - profile); |
| - router->OnAuthAttempted(GetAuthType(username), ""); |
| + ProfileHelper* profile_helper = ProfileHelper::Get(); |
| + Profile* profile = profile_helper->GetProfileByUser(unlock_user); |
|
xiyuan
2014/09/23 01:24:29
This call probably has side effect. I suspect that
tbarzic
2014/09/23 01:50:21
According to the method comment, it returns NULL i
xiyuan
2014/09/23 02:49:24
I see. In this case, I am okay leaving as is.
|
| + |
| + // The user profile should exists if and only if this is lock screen. |
| + DCHECK_NE(!profile, !ScreenLocker::default_screen_locker()); |
| + |
| + if (!profile) |
| + profile = profile_helper->GetSigninProfile(); |
| + |
| + EasyUnlockService::Get(profile)->AttemptAuth(username); |
| } |
| void SigninScreenHandler::HandleLaunchDemoUser() { |
| @@ -1216,8 +1244,8 @@ void SigninScreenHandler::HandleAccountPickerReady() { |
| if (ScreenLocker::default_screen_locker()) { |
| ScreenLocker::default_screen_locker()->delegate()->OnLockWebUIReady(); |
| - ScreenlockBridge::Get()->SetLockHandler(this); |
| } |
| + ScreenlockBridge::Get()->SetLockHandler(this); |
| if (delegate_) |
| delegate_->OnSigninScreenReady(); |