Commit 0fbbb42c authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Rename browser-side login types from *Views to *Mojo.

Also rename UserSelectionScreenProxy to UserBoardViewMojo.

The backend is a mojo client; the browser-side code should not know
that the implementation is in views.

Bug: 784495
Change-Id: I1f3933e7191a9be8f1d73720a27c747391763737
Reviewed-on: https://chromium-review.googlesource.com/1008843
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550458}
parent 3688c603
...@@ -1148,12 +1148,12 @@ source_set("chromeos") { ...@@ -1148,12 +1148,12 @@ source_set("chromeos") {
"login/ui/login_display_host.h", "login/ui/login_display_host.h",
"login/ui/login_display_host_common.cc", "login/ui/login_display_host_common.cc",
"login/ui/login_display_host_common.h", "login/ui/login_display_host_common.h",
"login/ui/login_display_host_views.cc", "login/ui/login_display_host_mojo.cc",
"login/ui/login_display_host_views.h", "login/ui/login_display_host_mojo.h",
"login/ui/login_display_host_webui.cc", "login/ui/login_display_host_webui.cc",
"login/ui/login_display_host_webui.h", "login/ui/login_display_host_webui.h",
"login/ui/login_display_views.cc", "login/ui/login_display_mojo.cc",
"login/ui/login_display_views.h", "login/ui/login_display_mojo.h",
"login/ui/login_display_webui.cc", "login/ui/login_display_webui.cc",
"login/ui/login_display_webui.h", "login/ui/login_display_webui.h",
"login/ui/login_feedback.cc", "login/ui/login_feedback.cc",
...@@ -1175,10 +1175,10 @@ source_set("chromeos") { ...@@ -1175,10 +1175,10 @@ source_set("chromeos") {
"login/ui/web_contents_forced_title.h", "login/ui/web_contents_forced_title.h",
"login/ui/webui_login_view.cc", "login/ui/webui_login_view.cc",
"login/ui/webui_login_view.h", "login/ui/webui_login_view.h",
"login/user_board_view_mojo.cc",
"login/user_board_view_mojo.h",
"login/user_flow.cc", "login/user_flow.cc",
"login/user_flow.h", "login/user_flow.h",
"login/user_selection_screen_proxy.cc",
"login/user_selection_screen_proxy.h",
"login/users/affiliation.cc", "login/users/affiliation.cc",
"login/users/affiliation.h", "login/users/affiliation.h",
"login/users/avatar/user_image_loader.cc", "login/users/avatar/user_image_loader.cc",
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h"
#include "chrome/browser/chromeos/login/user_selection_screen_proxy.h" #include "chrome/browser/chromeos/login/user_board_view_mojo.h"
#include "chrome/browser/chromeos/system/system_clock.h" #include "chrome/browser/chromeos/system/system_clock.h"
#include "chrome/browser/ui/ash/session_controller_client.h" #include "chrome/browser/ui/ash/session_controller_client.h"
#include "chrome/browser/ui/ash/wallpaper_controller_client.h" #include "chrome/browser/ui/ash/wallpaper_controller_client.h"
...@@ -46,10 +46,10 @@ ViewsScreenLocker::ViewsScreenLocker(ScreenLocker* screen_locker) ...@@ -46,10 +46,10 @@ ViewsScreenLocker::ViewsScreenLocker(ScreenLocker* screen_locker)
version_info_updater_(this), version_info_updater_(this),
weak_factory_(this) { weak_factory_(this) {
LoginScreenClient::Get()->SetDelegate(this); LoginScreenClient::Get()->SetDelegate(this);
user_selection_screen_proxy_ = std::make_unique<UserSelectionScreenProxy>(); user_board_view_mojo_ = std::make_unique<UserBoardViewMojo>();
user_selection_screen_ = user_selection_screen_ =
std::make_unique<ChromeUserSelectionScreen>(kLockDisplay); std::make_unique<ChromeUserSelectionScreen>(kLockDisplay);
user_selection_screen_->SetView(user_selection_screen_proxy_.get()); user_selection_screen_->SetView(user_board_view_mojo_.get());
allowed_input_methods_subscription_ = allowed_input_methods_subscription_ =
CrosSettings::Get()->AddSettingsObserver( CrosSettings::Get()->AddSettingsObserver(
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
namespace chromeos { namespace chromeos {
class UserBoardViewMojo;
class UserSelectionScreen; class UserSelectionScreen;
class UserSelectionScreenProxy;
// ViewsScreenLocker acts like LoginScreenClient::Delegate which handles method // ViewsScreenLocker acts like LoginScreenClient::Delegate which handles method
// calls coming from ash into chrome. // calls coming from ash into chrome.
...@@ -87,7 +87,7 @@ class ViewsScreenLocker : public LoginScreenClient::Delegate, ...@@ -87,7 +87,7 @@ class ViewsScreenLocker : public LoginScreenClient::Delegate,
void OnAllowedInputMethodsChanged(); void OnAllowedInputMethodsChanged();
void OnDevChannelInfoUpdated(); void OnDevChannelInfoUpdated();
std::unique_ptr<UserSelectionScreenProxy> user_selection_screen_proxy_; std::unique_ptr<UserBoardViewMojo> user_board_view_mojo_;
std::unique_ptr<UserSelectionScreen> user_selection_screen_; std::unique_ptr<UserSelectionScreen> user_selection_screen_;
// The ScreenLocker that owns this instance. // The ScreenLocker that owns this instance.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "chrome/browser/chromeos/login/ui/gaia_dialog_delegate.h" #include "chrome/browser/chromeos/login/ui/gaia_dialog_delegate.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_views.h" #include "chrome/browser/chromeos/login/ui/login_display_host_mojo.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
...@@ -29,7 +29,7 @@ constexpr int kGaiaDialogWidth = 768; ...@@ -29,7 +29,7 @@ constexpr int kGaiaDialogWidth = 768;
} // namespace } // namespace
GaiaDialogDelegate::GaiaDialogDelegate( GaiaDialogDelegate::GaiaDialogDelegate(
base::WeakPtr<LoginDisplayHostViews> controller) base::WeakPtr<LoginDisplayHostMojo> controller)
: controller_(controller), : controller_(controller),
size_(gfx::Size(kGaiaDialogWidth, kGaiaDialogHeight)) {} size_(gfx::Size(kGaiaDialogWidth, kGaiaDialogHeight)) {}
......
...@@ -23,7 +23,7 @@ class Widget; ...@@ -23,7 +23,7 @@ class Widget;
namespace chromeos { namespace chromeos {
class LoginDisplayHostViews; class LoginDisplayHostMojo;
class OobeUI; class OobeUI;
// This class manages the behavior of the gaia signin dialog. // This class manages the behavior of the gaia signin dialog.
...@@ -35,7 +35,7 @@ class OobeUI; ...@@ -35,7 +35,7 @@ class OobeUI;
// clientView---->Widget's view hierarchy // clientView---->Widget's view hierarchy
class GaiaDialogDelegate : public ui::WebDialogDelegate { class GaiaDialogDelegate : public ui::WebDialogDelegate {
public: public:
explicit GaiaDialogDelegate(base::WeakPtr<LoginDisplayHostViews> controller); explicit GaiaDialogDelegate(base::WeakPtr<LoginDisplayHostMojo> controller);
~GaiaDialogDelegate() override; ~GaiaDialogDelegate() override;
// Show the dialog widget. // Show the dialog widget.
...@@ -74,7 +74,7 @@ class GaiaDialogDelegate : public ui::WebDialogDelegate { ...@@ -74,7 +74,7 @@ class GaiaDialogDelegate : public ui::WebDialogDelegate {
std::vector<ui::Accelerator> GetAccelerators() override; std::vector<ui::Accelerator> GetAccelerators() override;
bool AcceleratorPressed(const ui::Accelerator& accelerator) override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
base::WeakPtr<LoginDisplayHostViews> controller_; base::WeakPtr<LoginDisplayHostMojo> controller_;
// This is owned by the underlying native widget. // This is owned by the underlying native widget.
// Before its deletion, onDialogClosed will get called and delete this object. // Before its deletion, onDialogClosed will get called and delete this object.
......
...@@ -35,14 +35,16 @@ class WizardController; ...@@ -35,14 +35,16 @@ class WizardController;
// / | // / |
// LoginDisplayHostCommon MockLoginDisplayHost // LoginDisplayHostCommon MockLoginDisplayHost
// / | // / |
// LoginDisplayHostViews LoginDisplayHostWebUI // LoginDisplayHostMojo LoginDisplayHostWebUI
// //
// //
// - LoginDisplayHost defines the generic interface. // - LoginDisplayHost defines the generic interface.
// - LoginDisplayHostCommon is UI-agnostic code shared between the views and // - LoginDisplayHostCommon is UI-agnostic code shared between the views and
// webui hosts. // webui hosts.
// - MockLoginDisplayHost is for tests. // - MockLoginDisplayHost is for tests.
// - LoginDisplayHostViews is for the login screen, which is written in views. // - LoginDisplayHostMojo is for the login screen which is a mojo controller
// (ie, ash/public/interfaces/login_screen.mojom,
// ash/login/login_screen_controller.h).
// - LoginDisplayHostWebUI is for OOBE, which is written in HTML/JS/CSS. // - LoginDisplayHostWebUI is for OOBE, which is written in HTML/JS/CSS.
class LoginDisplayHost { class LoginDisplayHost {
public: public:
......
...@@ -26,7 +26,7 @@ class DemoAppLauncher; ...@@ -26,7 +26,7 @@ class DemoAppLauncher;
// LoginDisplayHostCommon contains code which is not specific to a particular UI // LoginDisplayHostCommon contains code which is not specific to a particular UI
// implementation - the goal is to reduce code duplication between // implementation - the goal is to reduce code duplication between
// LoginDisplayHostViews and LoginDisplayHostWebUI. // LoginDisplayHostMojo and LoginDisplayHostWebUI.
class LoginDisplayHostCommon : public LoginDisplayHost, class LoginDisplayHostCommon : public LoginDisplayHost,
public content::NotificationObserver { public content::NotificationObserver {
public: public:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/chromeos/login/ui/login_display_host_views.h" #include "chrome/browser/chromeos/login/ui/login_display_host_mojo.h"
#include <string> #include <string>
#include <utility> #include <utility>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "chrome/browser/chromeos/login/screens/gaia_view.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/gaia_dialog_delegate.h"
#include "chrome/browser/chromeos/login/ui/login_display.h" #include "chrome/browser/chromeos/login/ui/login_display.h"
#include "chrome/browser/chromeos/login/ui/login_display_views.h" #include "chrome/browser/chromeos/login/ui/login_display_mojo.h"
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chromeos/login/auth/user_context.h" #include "chromeos/login/auth/user_context.h"
...@@ -20,50 +20,61 @@ ...@@ -20,50 +20,61 @@
namespace chromeos { namespace chromeos {
LoginDisplayHostViews::LoginDisplayHostViews() : weak_factory_(this) { LoginDisplayHostMojo::LoginDisplayHostMojo() : weak_factory_(this) {
// Preload the WebUI for post-login screens. // Preload the WebUI for post-login screens.
InitWidgetAndView(); InitWidgetAndView();
} }
LoginDisplayHostViews::~LoginDisplayHostViews() { LoginDisplayHostMojo::~LoginDisplayHostMojo() {
LoginScreenClient::Get()->SetDelegate(nullptr); LoginScreenClient::Get()->SetDelegate(nullptr);
if (dialog_) if (dialog_)
dialog_->Close(); dialog_->Close();
} }
LoginDisplay* LoginDisplayHostViews::CreateLoginDisplay( void LoginDisplayHostMojo::OnDialogDestroyed(const GaiaDialogDelegate* dialog) {
if (dialog == dialog_) {
dialog_ = nullptr;
wizard_controller_.reset();
}
}
void LoginDisplayHostMojo::SetUsers(const user_manager::UserList& users) {
users_ = users;
}
LoginDisplay* LoginDisplayHostMojo::CreateLoginDisplay(
LoginDisplay::Delegate* delegate) { LoginDisplay::Delegate* delegate) {
return new LoginDisplayViews(delegate, this); return new LoginDisplayMojo(delegate, this);
} }
gfx::NativeWindow LoginDisplayHostViews::GetNativeWindow() const { gfx::NativeWindow LoginDisplayHostMojo::GetNativeWindow() const {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return nullptr; return nullptr;
} }
OobeUI* LoginDisplayHostViews::GetOobeUI() const { OobeUI* LoginDisplayHostMojo::GetOobeUI() const {
if (!dialog_) if (!dialog_)
return nullptr; return nullptr;
return dialog_->GetOobeUI(); return dialog_->GetOobeUI();
} }
WebUILoginView* LoginDisplayHostViews::GetWebUILoginView() const { WebUILoginView* LoginDisplayHostMojo::GetWebUILoginView() const {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
} }
void LoginDisplayHostViews::OnFinalize() { void LoginDisplayHostMojo::OnFinalize() {
if (dialog_) if (dialog_)
dialog_->Close(); dialog_->Close();
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
} }
void LoginDisplayHostViews::SetStatusAreaVisible(bool visible) { void LoginDisplayHostMojo::SetStatusAreaVisible(bool visible) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::StartWizard(OobeScreen first_screen) { void LoginDisplayHostMojo::StartWizard(OobeScreen first_screen) {
DCHECK(GetOobeUI()); DCHECK(GetOobeUI());
// Dtor of the old WizardController should be called before ctor of the // Dtor of the old WizardController should be called before ctor of the
...@@ -76,20 +87,20 @@ void LoginDisplayHostViews::StartWizard(OobeScreen first_screen) { ...@@ -76,20 +87,20 @@ void LoginDisplayHostViews::StartWizard(OobeScreen first_screen) {
dialog_->Show(false /*closable_by_esc*/); dialog_->Show(false /*closable_by_esc*/);
} }
WizardController* LoginDisplayHostViews::GetWizardController() { WizardController* LoginDisplayHostMojo::GetWizardController() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return nullptr; return nullptr;
} }
void LoginDisplayHostViews::OnStartUserAdding() { void LoginDisplayHostMojo::OnStartUserAdding() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::CancelUserAdding() { void LoginDisplayHostMojo::CancelUserAdding() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::OnStartSignInScreen( void LoginDisplayHostMojo::OnStartSignInScreen(
const LoginScreenContext& context) { const LoginScreenContext& context) {
// This function may be called early in startup flow, before LoginScreenClient // This function may be called early in startup flow, before LoginScreenClient
// has been initialized. Wait until LoginScreenClient is initialized as it is // has been initialized. Wait until LoginScreenClient is initialized as it is
...@@ -97,7 +108,7 @@ void LoginDisplayHostViews::OnStartSignInScreen( ...@@ -97,7 +108,7 @@ void LoginDisplayHostViews::OnStartSignInScreen(
if (!LoginScreenClient::HasInstance()) { if (!LoginScreenClient::HasInstance()) {
// TODO(jdufault): Add a timeout here / make sure we do not post infinitely. // TODO(jdufault): Add a timeout here / make sure we do not post infinitely.
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&LoginDisplayHostViews::OnStartSignInScreen, FROM_HERE, base::BindOnce(&LoginDisplayHostMojo::OnStartSignInScreen,
weak_factory_.GetWeakPtr(), context)); weak_factory_.GetWeakPtr(), context));
return; return;
} }
...@@ -113,32 +124,32 @@ void LoginDisplayHostViews::OnStartSignInScreen( ...@@ -113,32 +124,32 @@ void LoginDisplayHostViews::OnStartSignInScreen(
existing_user_controller_->Init(user_manager::UserManager::Get()->GetUsers()); existing_user_controller_->Init(user_manager::UserManager::Get()->GetUsers());
} }
void LoginDisplayHostViews::OnPreferencesChanged() { void LoginDisplayHostMojo::OnPreferencesChanged() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::OnStartAppLaunch() { void LoginDisplayHostMojo::OnStartAppLaunch() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::OnStartArcKiosk() { void LoginDisplayHostMojo::OnStartArcKiosk() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::OnBrowserCreated() { void LoginDisplayHostMojo::OnBrowserCreated() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::StartVoiceInteractionOobe() { void LoginDisplayHostMojo::StartVoiceInteractionOobe() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
bool LoginDisplayHostViews::IsVoiceInteractionOobe() { bool LoginDisplayHostMojo::IsVoiceInteractionOobe() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
void LoginDisplayHostViews::UpdateGaiaDialogVisibility(bool visible) { void LoginDisplayHostMojo::UpdateGaiaDialogVisibility(bool visible) {
DCHECK(dialog_); DCHECK(dialog_);
if (visible) { if (visible) {
dialog_->Show(true /*closable_by_esc*/); dialog_->Show(true /*closable_by_esc*/);
...@@ -155,16 +166,16 @@ void LoginDisplayHostViews::UpdateGaiaDialogVisibility(bool visible) { ...@@ -155,16 +166,16 @@ void LoginDisplayHostViews::UpdateGaiaDialogVisibility(bool visible) {
dialog_->Hide(); dialog_->Hide();
} }
void LoginDisplayHostViews::UpdateGaiaDialogSize(int width, int height) { void LoginDisplayHostMojo::UpdateGaiaDialogSize(int width, int height) {
if (dialog_) if (dialog_)
dialog_->SetSize(width, height); dialog_->SetSize(width, height);
} }
const user_manager::UserList LoginDisplayHostViews::GetUsers() { const user_manager::UserList LoginDisplayHostMojo::GetUsers() {
return users_; return users_;
} }
void LoginDisplayHostViews::HandleAuthenticateUser( void LoginDisplayHostMojo::HandleAuthenticateUser(
const AccountId& account_id, const AccountId& account_id,
const std::string& hashed_password, const std::string& hashed_password,
const password_manager::SyncPasswordData& sync_password_data, const password_manager::SyncPasswordData& sync_password_data,
...@@ -186,39 +197,39 @@ void LoginDisplayHostViews::HandleAuthenticateUser( ...@@ -186,39 +197,39 @@ void LoginDisplayHostViews::HandleAuthenticateUser(
existing_user_controller_->Login(user_context, chromeos::SigninSpecifics()); existing_user_controller_->Login(user_context, chromeos::SigninSpecifics());
} }
void LoginDisplayHostViews::HandleAttemptUnlock(const AccountId& account_id) { void LoginDisplayHostMojo::HandleAttemptUnlock(const AccountId& account_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::HandleHardlockPod(const AccountId& account_id) { void LoginDisplayHostMojo::HandleHardlockPod(const AccountId& account_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::HandleRecordClickOnLockIcon( void LoginDisplayHostMojo::HandleRecordClickOnLockIcon(
const AccountId& account_id) { const AccountId& account_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::HandleOnFocusPod(const AccountId& account_id) { void LoginDisplayHostMojo::HandleOnFocusPod(const AccountId& account_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayHostViews::HandleOnNoPodFocused() { void LoginDisplayHostMojo::HandleOnNoPodFocused() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
bool LoginDisplayHostViews::HandleFocusLockScreenApps(bool reverse) { bool LoginDisplayHostMojo::HandleFocusLockScreenApps(bool reverse) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
void LoginDisplayHostViews::HandleLoginAsGuest() { void LoginDisplayHostMojo::HandleLoginAsGuest() {
existing_user_controller_->Login(UserContext(user_manager::USER_TYPE_GUEST, existing_user_controller_->Login(UserContext(user_manager::USER_TYPE_GUEST,
user_manager::GuestAccountId()), user_manager::GuestAccountId()),
chromeos::SigninSpecifics()); chromeos::SigninSpecifics());
} }
void LoginDisplayHostViews::HandleLaunchPublicSession( void LoginDisplayHostMojo::HandleLaunchPublicSession(
const AccountId& account_id, const AccountId& account_id,
const std::string& locale, const std::string& locale,
const std::string& input_method) { const std::string& input_method) {
...@@ -228,29 +239,17 @@ void LoginDisplayHostViews::HandleLaunchPublicSession( ...@@ -228,29 +239,17 @@ void LoginDisplayHostViews::HandleLaunchPublicSession(
existing_user_controller_->Login(context, chromeos::SigninSpecifics()); existing_user_controller_->Login(context, chromeos::SigninSpecifics());
} }
void LoginDisplayHostViews::OnAuthFailure(const AuthFailure& error) { void LoginDisplayHostMojo::OnAuthFailure(const AuthFailure& error) {
if (on_authenticated_) if (on_authenticated_)
std::move(on_authenticated_).Run(false); std::move(on_authenticated_).Run(false);
} }
void LoginDisplayHostViews::OnAuthSuccess(const UserContext& user_context) { void LoginDisplayHostMojo::OnAuthSuccess(const UserContext& user_context) {
if (on_authenticated_) if (on_authenticated_)
std::move(on_authenticated_).Run(true); std::move(on_authenticated_).Run(true);
} }
void LoginDisplayHostViews::OnDialogDestroyed( void LoginDisplayHostMojo::InitWidgetAndView() {
const GaiaDialogDelegate* dialog) {
if (dialog == dialog_) {
dialog_ = nullptr;
wizard_controller_.reset();
}
}
void LoginDisplayHostViews::SetUsers(const user_manager::UserList& users) {
users_ = users;
}
void LoginDisplayHostViews::InitWidgetAndView() {
if (dialog_) if (dialog_)
return; return;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_VIEWS_H_ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_MOJO_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_VIEWS_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_MOJO_H_
#include <memory> #include <memory>
#include <string> #include <string>
...@@ -22,12 +22,18 @@ class GaiaDialogDelegate; ...@@ -22,12 +22,18 @@ class GaiaDialogDelegate;
// A LoginDisplayHost instance that sends requests to the views-based signin // A LoginDisplayHost instance that sends requests to the views-based signin
// screen. // screen.
class LoginDisplayHostViews : public LoginDisplayHostCommon, class LoginDisplayHostMojo : public LoginDisplayHostCommon,
public LoginScreenClient::Delegate, public LoginScreenClient::Delegate,
public AuthStatusConsumer { public AuthStatusConsumer {
public: public:
LoginDisplayHostViews(); LoginDisplayHostMojo();
~LoginDisplayHostViews() override; ~LoginDisplayHostMojo() override;
// Called when the gaia dialog is destroyed.
void OnDialogDestroyed(const GaiaDialogDelegate* dialog);
// Set the users in the views login screen.
void SetUsers(const user_manager::UserList& users);
// LoginDisplayHost: // LoginDisplayHost:
LoginDisplay* CreateLoginDisplay(LoginDisplay::Delegate* delegate) override; LoginDisplay* CreateLoginDisplay(LoginDisplay::Delegate* delegate) override;
...@@ -73,12 +79,6 @@ class LoginDisplayHostViews : public LoginDisplayHostCommon, ...@@ -73,12 +79,6 @@ class LoginDisplayHostViews : public LoginDisplayHostCommon,
void OnAuthFailure(const AuthFailure& error) override; void OnAuthFailure(const AuthFailure& error) override;
void OnAuthSuccess(const UserContext& user_context) override; void OnAuthSuccess(const UserContext& user_context) override;
// Called when the gaia dialog is destroyed.
void OnDialogDestroyed(const GaiaDialogDelegate* dialog);
// Set the users in the views login screen.
void SetUsers(const user_manager::UserList& users);
private: private:
// Initialize the dialog widget for webui (for gaia and post login screens). // Initialize the dialog widget for webui (for gaia and post login screens).
void InitWidgetAndView(); void InitWidgetAndView();
...@@ -97,11 +97,11 @@ class LoginDisplayHostViews : public LoginDisplayHostCommon, ...@@ -97,11 +97,11 @@ class LoginDisplayHostViews : public LoginDisplayHostCommon,
// TODO(crbug.com/808277): consider remove user case. // TODO(crbug.com/808277): consider remove user case.
user_manager::UserList users_; user_manager::UserList users_;
base::WeakPtrFactory<LoginDisplayHostViews> weak_factory_; base::WeakPtrFactory<LoginDisplayHostMojo> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(LoginDisplayHostViews); DISALLOW_COPY_AND_ASSIGN(LoginDisplayHostMojo);
}; };
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_VIEWS_H_ #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_HOST_MOJO_H_
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "chrome/browser/chromeos/login/signin/token_handle_util.h" #include "chrome/browser/chromeos/login/signin/token_handle_util.h"
#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/input_events_blocker.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_views.h" #include "chrome/browser/chromeos/login/ui/login_display_host_mojo.h"
#include "chrome/browser/chromeos/login/ui/login_display_webui.h" #include "chrome/browser/chromeos/login/ui/login_display_webui.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h" #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
...@@ -204,7 +204,7 @@ void ShowLoginWizardFinish( ...@@ -204,7 +204,7 @@ void ShowLoginWizardFinish(
display_host = chromeos::LoginDisplayHost::default_host(); display_host = chromeos::LoginDisplayHost::default_host();
} else if (ash::switches::IsUsingViewsLogin() && } else if (ash::switches::IsUsingViewsLogin() &&
ShouldShowSigninScreen(first_screen)) { ShouldShowSigninScreen(first_screen)) {
display_host = new chromeos::LoginDisplayHostViews(); display_host = new chromeos::LoginDisplayHostMojo();
} else { } else {
display_host = new chromeos::LoginDisplayHostWebUI(); display_host = new chromeos::LoginDisplayHostWebUI();
} }
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/chromeos/login/ui/login_display_views.h" #include "chrome/browser/chromeos/login/ui/login_display_mojo.h"
#include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" #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/screens/user_selection_screen.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_views.h" #include "chrome/browser/chromeos/login/ui/login_display_host_mojo.h"
#include "chrome/browser/chromeos/login/user_selection_screen_proxy.h" #include "chrome/browser/chromeos/login/user_board_view_mojo.h"
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/ui/ash/login_screen_client.h" #include "chrome/browser/ui/ash/login_screen_client.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
...@@ -20,25 +20,24 @@ namespace { ...@@ -20,25 +20,24 @@ namespace {
constexpr char kLoginDisplay[] = "login"; constexpr char kLoginDisplay[] = "login";
} // namespace } // namespace
LoginDisplayViews::LoginDisplayViews(Delegate* delegate, LoginDisplayMojo::LoginDisplayMojo(Delegate* delegate,
LoginDisplayHostViews* host) LoginDisplayHostMojo* host)
: LoginDisplay(delegate), : LoginDisplay(delegate),
host_(host), host_(host),
user_selection_screen_proxy_( user_board_view_mojo_(std::make_unique<UserBoardViewMojo>()),
std::make_unique<UserSelectionScreenProxy>()),
user_selection_screen_( user_selection_screen_(
std::make_unique<ChromeUserSelectionScreen>(kLoginDisplay)) { std::make_unique<ChromeUserSelectionScreen>(kLoginDisplay)) {
user_selection_screen_->SetView(user_selection_screen_proxy_.get()); user_selection_screen_->SetView(user_board_view_mojo_.get());
} }
LoginDisplayViews::~LoginDisplayViews() = default; LoginDisplayMojo::~LoginDisplayMojo() = default;
void LoginDisplayViews::ClearAndEnablePassword() {} void LoginDisplayMojo::ClearAndEnablePassword() {}
void LoginDisplayViews::Init(const user_manager::UserList& filtered_users, void LoginDisplayMojo::Init(const user_manager::UserList& filtered_users,
bool show_guest, bool show_guest,
bool show_users, bool show_users,
bool show_new_user) { bool show_new_user) {
host_->SetUsers(filtered_users); host_->SetUsers(filtered_users);
// Load the login screen. // Load the login screen.
...@@ -61,38 +60,38 @@ void LoginDisplayViews::Init(const user_manager::UserList& filtered_users, ...@@ -61,38 +60,38 @@ void LoginDisplayViews::Init(const user_manager::UserList& filtered_users,
user_selection_screen_->SetUsersLoaded(true /*loaded*/); user_selection_screen_->SetUsersLoaded(true /*loaded*/);
} }
void LoginDisplayViews::OnPreferencesChanged() { void LoginDisplayMojo::OnPreferencesChanged() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::SetUIEnabled(bool is_enabled) { void LoginDisplayMojo::SetUIEnabled(bool is_enabled) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowError(int error_msg_id, void LoginDisplayMojo::ShowError(int error_msg_id,
int login_attempts, int login_attempts,
HelpAppLauncher::HelpTopic help_topic_id) { HelpAppLauncher::HelpTopic help_topic_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowErrorScreen(LoginDisplay::SigninError error_id) { void LoginDisplayMojo::ShowErrorScreen(LoginDisplay::SigninError error_id) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowPasswordChangedDialog(bool show_password_error, void LoginDisplayMojo::ShowPasswordChangedDialog(bool show_password_error,
const std::string& email) { const std::string& email) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowSigninUI(const std::string& email) { void LoginDisplayMojo::ShowSigninUI(const std::string& email) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowWhitelistCheckFailedError() { void LoginDisplayMojo::ShowWhitelistCheckFailedError() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LoginDisplayViews::ShowUnrecoverableCrypthomeErrorDialog() { void LoginDisplayMojo::ShowUnrecoverableCrypthomeErrorDialog() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_VIEWS_H_ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_MOJO_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_VIEWS_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_MOJO_H_
#include <memory> #include <memory>
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
namespace chromeos { namespace chromeos {
class LoginDisplayHostViews; class LoginDisplayHostMojo;
class UserBoardViewMojo;
class UserSelectionScreen; class UserSelectionScreen;
class UserSelectionScreenProxy;
// Interface used by UI-agnostic code to send messages to views-based login // Interface used by UI-agnostic code to send messages to views-based login
// screen. // screen.
class LoginDisplayViews : public LoginDisplay { class LoginDisplayMojo : public LoginDisplay {
public: public:
LoginDisplayViews(Delegate* delegate, LoginDisplayHostViews* host); LoginDisplayMojo(Delegate* delegate, LoginDisplayHostMojo* host);
~LoginDisplayViews() override; ~LoginDisplayMojo() override;
// LoginDisplay: // LoginDisplay:
void ClearAndEnablePassword() override; void ClearAndEnablePassword() override;
...@@ -42,13 +42,13 @@ class LoginDisplayViews : public LoginDisplay { ...@@ -42,13 +42,13 @@ class LoginDisplayViews : public LoginDisplay {
void ShowUnrecoverableCrypthomeErrorDialog() override; void ShowUnrecoverableCrypthomeErrorDialog() override;
private: private:
LoginDisplayHostViews* const host_ = nullptr; LoginDisplayHostMojo* const host_ = nullptr;
std::unique_ptr<UserSelectionScreenProxy> user_selection_screen_proxy_; std::unique_ptr<UserBoardViewMojo> user_board_view_mojo_;
std::unique_ptr<UserSelectionScreen> user_selection_screen_; std::unique_ptr<UserSelectionScreen> user_selection_screen_;
DISALLOW_COPY_AND_ASSIGN(LoginDisplayViews); DISALLOW_COPY_AND_ASSIGN(LoginDisplayMojo);
}; };
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_VIEWS_H_ #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_DISPLAY_MOJO_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/chromeos/login/user_selection_screen_proxy.h" #include "chrome/browser/chromeos/login/user_board_view_mojo.h"
#include <utility> #include <utility>
...@@ -63,18 +63,18 @@ ash::mojom::EasyUnlockIconOptionsPtr ToEasyUnlockIconOptionsPtr( ...@@ -63,18 +63,18 @@ ash::mojom::EasyUnlockIconOptionsPtr ToEasyUnlockIconOptionsPtr(
} // namespace } // namespace
UserSelectionScreenProxy::UserSelectionScreenProxy() = default; UserBoardViewMojo::UserBoardViewMojo() : weak_factory_(this) {}
UserSelectionScreenProxy::~UserSelectionScreenProxy() = default; UserBoardViewMojo::~UserBoardViewMojo() = default;
void UserSelectionScreenProxy::SetPublicSessionDisplayName( void UserBoardViewMojo::SetPublicSessionDisplayName(
const AccountId& account_id, const AccountId& account_id,
const std::string& display_name) { const std::string& display_name) {
LoginScreenClient::Get()->login_screen()->SetPublicSessionDisplayName( LoginScreenClient::Get()->login_screen()->SetPublicSessionDisplayName(
account_id, display_name); account_id, display_name);
} }
void UserSelectionScreenProxy::SetPublicSessionLocales( void UserBoardViewMojo::SetPublicSessionLocales(
const AccountId& account_id, const AccountId& account_id,
std::unique_ptr<base::ListValue> locales, std::unique_ptr<base::ListValue> locales,
const std::string& default_locale, const std::string& default_locale,
...@@ -84,7 +84,7 @@ void UserSelectionScreenProxy::SetPublicSessionLocales( ...@@ -84,7 +84,7 @@ void UserSelectionScreenProxy::SetPublicSessionLocales(
multiple_recommended_locales); multiple_recommended_locales);
} }
void UserSelectionScreenProxy::ShowUserPodCustomIcon( void UserBoardViewMojo::ShowUserPodCustomIcon(
const AccountId& account_id, const AccountId& account_id,
const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions&
icon_options) { icon_options) {
...@@ -96,21 +96,19 @@ void UserSelectionScreenProxy::ShowUserPodCustomIcon( ...@@ -96,21 +96,19 @@ void UserSelectionScreenProxy::ShowUserPodCustomIcon(
account_id, std::move(icon)); account_id, std::move(icon));
} }
void UserSelectionScreenProxy::HideUserPodCustomIcon( void UserBoardViewMojo::HideUserPodCustomIcon(const AccountId& account_id) {
const AccountId& account_id) {
LoginScreenClient::Get()->login_screen()->HideUserPodCustomIcon(account_id); LoginScreenClient::Get()->login_screen()->HideUserPodCustomIcon(account_id);
} }
void UserSelectionScreenProxy::SetAuthType( void UserBoardViewMojo::SetAuthType(const AccountId& account_id,
const AccountId& account_id, proximity_auth::mojom::AuthType auth_type,
proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) {
const base::string16& initial_value) {
LoginScreenClient::Get()->login_screen()->SetAuthType(account_id, auth_type, LoginScreenClient::Get()->login_screen()->SetAuthType(account_id, auth_type,
initial_value); initial_value);
} }
base::WeakPtr<chromeos::UserBoardView> UserSelectionScreenProxy::GetWeakPtr() { base::WeakPtr<UserBoardView> UserBoardViewMojo::GetWeakPtr() {
return base::WeakPtr<chromeos::UserBoardView>(); return weak_factory_.GetWeakPtr();
} }
} // namespace chromeos } // namespace chromeos
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_SELECTION_SCREEN_PROXY_H_ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_BOARD_VIEW_MOJO_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_USER_SELECTION_SCREEN_PROXY_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_BOARD_VIEW_MOJO_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -11,12 +11,11 @@ ...@@ -11,12 +11,11 @@
namespace chromeos { namespace chromeos {
// This class is a proxy layer which handles calls from UserSelectionScreen and // UserBoardView implementation that forwards calls to ash via mojo.
// send them to ash. class UserBoardViewMojo : public UserBoardView {
class UserSelectionScreenProxy : public chromeos::UserBoardView {
public: public:
UserSelectionScreenProxy(); UserBoardViewMojo();
~UserSelectionScreenProxy() override; ~UserBoardViewMojo() override;
// UserBoardView: // UserBoardView:
void SetPublicSessionDisplayName(const AccountId& account_id, void SetPublicSessionDisplayName(const AccountId& account_id,
...@@ -35,14 +34,16 @@ class UserSelectionScreenProxy : public chromeos::UserBoardView { ...@@ -35,14 +34,16 @@ class UserSelectionScreenProxy : public chromeos::UserBoardView {
void SetAuthType(const AccountId& account_id, void SetAuthType(const AccountId& account_id,
proximity_auth::mojom::AuthType auth_type, proximity_auth::mojom::AuthType auth_type,
const base::string16& initial_value) override; const base::string16& initial_value) override;
void Bind(chromeos::UserSelectionScreen* screen) override{}; void Bind(UserSelectionScreen* screen) override{};
void Unbind() override{}; void Unbind() override{};
base::WeakPtr<UserBoardView> GetWeakPtr() override; base::WeakPtr<UserBoardView> GetWeakPtr() override;
private: private:
DISALLOW_COPY_AND_ASSIGN(UserSelectionScreenProxy); base::WeakPtrFactory<UserBoardViewMojo> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(UserBoardViewMojo);
}; };
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_SELECTION_SCREEN_PROXY_H_ #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_BOARD_VIEW_MOJO_H_
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