Commit 77e24b10 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Easy unlock support for views-based login.

Bug: 784495
Change-Id: Ib2b5da041eb483c45fc67f1da9ac364e85142df4
Reviewed-on: https://chromium-review.googlesource.com/1008416Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552915}
parent e3499308
......@@ -9,10 +9,12 @@
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
#include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_view.h"
#include "chrome/browser/chromeos/login/ui/gaia_dialog_delegate.h"
#include "chrome/browser/chromeos/login/ui/login_display.h"
#include "chrome/browser/chromeos/login/ui/login_display_mojo.h"
#include "chrome/browser/chromeos/login/user_board_view_mojo.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chromeos/login/auth/user_context.h"
......@@ -20,7 +22,17 @@
namespace chromeos {
LoginDisplayHostMojo::LoginDisplayHostMojo() : weak_factory_(this) {
namespace {
constexpr char kLoginDisplay[] = "login";
} // namespace
LoginDisplayHostMojo::LoginDisplayHostMojo()
: user_board_view_mojo_(std::make_unique<UserBoardViewMojo>()),
user_selection_screen_(
std::make_unique<ChromeUserSelectionScreen>(kLoginDisplay)),
weak_factory_(this) {
user_selection_screen_->SetView(user_board_view_mojo_.get());
// Preload the WebUI for post-login screens.
InitWidgetAndView();
}
......@@ -198,20 +210,22 @@ void LoginDisplayHostMojo::HandleAuthenticateUser(
}
void LoginDisplayHostMojo::HandleAttemptUnlock(const AccountId& account_id) {
NOTIMPLEMENTED();
user_selection_screen_->AttemptEasyUnlock(account_id);
}
void LoginDisplayHostMojo::HandleHardlockPod(const AccountId& account_id) {
NOTIMPLEMENTED();
user_selection_screen_->HardLockPod(account_id);
}
void LoginDisplayHostMojo::HandleRecordClickOnLockIcon(
const AccountId& account_id) {
NOTIMPLEMENTED();
user_selection_screen_->RecordClickOnLockIcon(account_id);
}
void LoginDisplayHostMojo::HandleOnFocusPod(const AccountId& account_id) {
NOTIMPLEMENTED();
// TODO(jdufault): Share common code between this and
// ViewsScreenLocker::HandleOnFocusPod See https://crbug.com/831787.
user_selection_screen_->CheckUserStatus(account_id);
}
void LoginDisplayHostMojo::HandleOnNoPodFocused() {
......@@ -219,7 +233,7 @@ void LoginDisplayHostMojo::HandleOnNoPodFocused() {
}
bool LoginDisplayHostMojo::HandleFocusLockScreenApps(bool reverse) {
NOTIMPLEMENTED();
NOTREACHED();
return false;
}
......
......@@ -19,6 +19,8 @@ namespace chromeos {
class ExistingUserController;
class GaiaDialogDelegate;
class UserBoardViewMojo;
class UserSelectionScreen;
// A LoginDisplayHost instance that sends requests to the views-based signin
// screen.
......@@ -35,6 +37,10 @@ class LoginDisplayHostMojo : public LoginDisplayHostCommon,
// Set the users in the views login screen.
void SetUsers(const user_manager::UserList& users);
UserSelectionScreen* user_selection_screen() {
return user_selection_screen_.get();
}
// LoginDisplayHost:
LoginDisplay* CreateLoginDisplay(LoginDisplay::Delegate* delegate) override;
gfx::NativeWindow GetNativeWindow() const override;
......@@ -86,6 +92,9 @@ class LoginDisplayHostMojo : public LoginDisplayHostCommon,
// Callback that should be executed the authentication result is available.
AuthenticateUserCallback on_authenticated_;
std::unique_ptr<UserBoardViewMojo> user_board_view_mojo_;
std::unique_ptr<UserSelectionScreen> user_selection_screen_;
std::unique_ptr<ExistingUserController> existing_user_controller_;
// Called after host deletion.
......
......@@ -8,7 +8,6 @@
#include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h"
#include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_mojo.h"
#include "chrome/browser/chromeos/login/user_board_view_mojo.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/ui/ash/login_screen_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
......@@ -18,18 +17,9 @@
namespace chromeos {
namespace {
constexpr char kLoginDisplay[] = "login";
} // namespace
LoginDisplayMojo::LoginDisplayMojo(Delegate* delegate,
LoginDisplayHostMojo* host)
: LoginDisplay(delegate),
host_(host),
user_board_view_mojo_(std::make_unique<UserBoardViewMojo>()),
user_selection_screen_(
std::make_unique<ChromeUserSelectionScreen>(kLoginDisplay)) {
user_selection_screen_->SetView(user_board_view_mojo_.get());
: LoginDisplay(delegate), host_(host) {
user_manager::UserManager::Get()->AddObserver(this);
}
......@@ -64,10 +54,11 @@ void LoginDisplayMojo::Init(const user_manager::UserList& filtered_users,
content::NotificationService::NoDetails());
}));
user_selection_screen_->Init(filtered_users);
UserSelectionScreen* user_selection_screen = host_->user_selection_screen();
user_selection_screen->Init(filtered_users);
client->login_screen()->LoadUsers(
user_selection_screen_->UpdateAndReturnUserListForMojo(), show_guest);
user_selection_screen_->SetUsersLoaded(true /*loaded*/);
user_selection_screen->UpdateAndReturnUserListForMojo(), show_guest);
user_selection_screen->SetUsersLoaded(true /*loaded*/);
}
void LoginDisplayMojo::OnPreferencesChanged() {
......
......@@ -14,8 +14,6 @@
namespace chromeos {
class LoginDisplayHostMojo;
class UserBoardViewMojo;
class UserSelectionScreen;
// Interface used by UI-agnostic code to send messages to views-based login
// screen.
......@@ -48,8 +46,6 @@ class LoginDisplayMojo : public LoginDisplay,
private:
LoginDisplayHostMojo* const host_ = nullptr;
std::unique_ptr<UserBoardViewMojo> user_board_view_mojo_;
std::unique_ptr<UserSelectionScreen> user_selection_screen_;
DISALLOW_COPY_AND_ASSIGN(LoginDisplayMojo);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment