Commit 93ebc690 authored by Yicheng Li's avatar Yicheng Li Committed by Commit Bot

ash: Add AuthDialogController

AuthDialogController is called by UserAuthenticationServiceProvider
and is responsible for managing authentication dialogs and talking
to chromeos::ExtendedAuthenticator. The authentication functionality
is not implemented yet.

AuthDialogController is exported publicly because AuthDialogClient
(to be implemented) in Chrome needs to find it.

Bug: b:156258540
Change-Id: I4a8904c25431b1267d01b7ecce0400fbe9f00569
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2298542Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yicheng Li <yichengli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792774}
parent 65143e61
...@@ -462,6 +462,8 @@ component("ash") { ...@@ -462,6 +462,8 @@ component("ash") {
"in_session_auth/auth_dialog_debug_view.h", "in_session_auth/auth_dialog_debug_view.h",
"in_session_auth/in_session_auth_dialog.cc", "in_session_auth/in_session_auth_dialog.cc",
"in_session_auth/in_session_auth_dialog.h", "in_session_auth/in_session_auth_dialog.h",
"in_session_auth/in_session_auth_dialog_controller_impl.cc",
"in_session_auth/in_session_auth_dialog_controller_impl.h",
"keyboard/arc/arc_virtual_keyboard_container_layout_manager.cc", "keyboard/arc/arc_virtual_keyboard_container_layout_manager.cc",
"keyboard/arc/arc_virtual_keyboard_container_layout_manager.h", "keyboard/arc/arc_virtual_keyboard_container_layout_manager.h",
"keyboard/keyboard_controller_impl.cc", "keyboard/keyboard_controller_impl.cc",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/login/ui/non_accessible_view.h" #include "ash/login/ui/non_accessible_view.h"
#include "ash/login/ui/views_utils.h" #include "ash/login/ui/views_utils.h"
#include "ash/public/cpp/in_session_auth_dialog_controller.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/button/md_text_button.h"
...@@ -124,8 +125,10 @@ void AuthDialogDebugView::AddActionButtonsView() { ...@@ -124,8 +125,10 @@ void AuthDialogDebugView::AddActionButtonsView() {
void AuthDialogDebugView::ButtonPressed(views::Button* sender, void AuthDialogDebugView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
// TODO(yichengli): Enable cancel button to call AuthDialogController to if (sender == cancel_button_) {
// destroy the dialog. // DestroyAuthenticationDialog deletes |this|.
InSessionAuthDialogController::Get()->DestroyAuthenticationDialog();
}
// TODO(yichengli): Enable more options button when we have both fingerprint // TODO(yichengli): Enable more options button when we have both fingerprint
// view and password input view. // view and password input view.
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/in_session_auth/in_session_auth_dialog_controller_impl.h"
namespace ash {
InSessionAuthDialogControllerImpl::InSessionAuthDialogControllerImpl() =
default;
InSessionAuthDialogControllerImpl::~InSessionAuthDialogControllerImpl() =
default;
void InSessionAuthDialogControllerImpl::ShowAuthenticationDialog() {
dialog_ = std::make_unique<InSessionAuthDialog>();
}
void InSessionAuthDialogControllerImpl::DestroyAuthenticationDialog() {
dialog_.reset();
}
} // namespace ash
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_IN_SESSION_AUTH_IN_SESSION_AUTH_DIALOG_CONTROLLER_IMPL_H_
#define ASH_IN_SESSION_AUTH_IN_SESSION_AUTH_DIALOG_CONTROLLER_IMPL_H_
#include <memory>
#include "ash/in_session_auth/in_session_auth_dialog.h"
#include "ash/public/cpp/in_session_auth_dialog_controller.h"
namespace ash {
// InSessionAuthDialogControllerImpl persists as long as UI is running.
class InSessionAuthDialogControllerImpl : public InSessionAuthDialogController {
public:
InSessionAuthDialogControllerImpl();
InSessionAuthDialogControllerImpl(const InSessionAuthDialogControllerImpl&) =
delete;
InSessionAuthDialogControllerImpl& operator=(
const InSessionAuthDialogControllerImpl&) = delete;
~InSessionAuthDialogControllerImpl() override;
// InSessionAuthDialogController overrides
void ShowAuthenticationDialog() override;
void DestroyAuthenticationDialog() override;
private:
std::unique_ptr<InSessionAuthDialog> dialog_;
};
} // namespace ash
#endif // ASH_IN_SESSION_AUTH_IN_SESSION_AUTH_DIALOG_CONTROLLER_IMPL_H_
...@@ -146,6 +146,8 @@ component("cpp") { ...@@ -146,6 +146,8 @@ component("cpp") {
"immersive/immersive_fullscreen_controller_delegate.h", "immersive/immersive_fullscreen_controller_delegate.h",
"immersive/immersive_revealed_lock.cc", "immersive/immersive_revealed_lock.cc",
"immersive/immersive_revealed_lock.h", "immersive/immersive_revealed_lock.h",
"in_session_auth_dialog_controller.cc",
"in_session_auth_dialog_controller.h",
"keyboard/arc/arc_input_method_bounds_tracker.cc", "keyboard/arc/arc_input_method_bounds_tracker.cc",
"keyboard/arc/arc_input_method_bounds_tracker.h", "keyboard/arc/arc_input_method_bounds_tracker.h",
"keyboard/keyboard_config.h", "keyboard/keyboard_config.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/public/cpp/in_session_auth_dialog_controller.h"
#include "base/check_op.h"
namespace ash {
namespace {
InSessionAuthDialogController* g_instance = nullptr;
}
// static
InSessionAuthDialogController* InSessionAuthDialogController::Get() {
return g_instance;
}
InSessionAuthDialogController::InSessionAuthDialogController() {
DCHECK_EQ(nullptr, g_instance);
g_instance = this;
}
InSessionAuthDialogController::~InSessionAuthDialogController() {
DCHECK_EQ(this, g_instance);
g_instance = nullptr;
}
} // namespace ash
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_IN_SESSION_AUTH_DIALOG_CONTROLLER_H_
#define ASH_PUBLIC_CPP_IN_SESSION_AUTH_DIALOG_CONTROLLER_H_
#include "ash/public/cpp/ash_public_export.h"
namespace ash {
// InSessionAuthDialogController manages the in-session auth dialog.
class ASH_PUBLIC_EXPORT InSessionAuthDialogController {
public:
// Return the singleton instance.
static InSessionAuthDialogController* Get();
// Displays the authentication dialog.
virtual void ShowAuthenticationDialog() = 0;
// Destroys the authentication dialog.
virtual void DestroyAuthenticationDialog() = 0;
protected:
InSessionAuthDialogController();
virtual ~InSessionAuthDialogController();
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_IN_SESSION_AUTH_DIALOG_CONTROLLER_H_
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "ash/host/ash_window_tree_host_init_params.h" #include "ash/host/ash_window_tree_host_init_params.h"
#include "ash/hud_display/hud_display.h" #include "ash/hud_display/hud_display.h"
#include "ash/ime/ime_controller_impl.h" #include "ash/ime/ime_controller_impl.h"
#include "ash/in_session_auth/in_session_auth_dialog_controller_impl.h"
#include "ash/keyboard/keyboard_controller_impl.h" #include "ash/keyboard/keyboard_controller_impl.h"
#include "ash/keyboard/ui/keyboard_ui_factory.h" #include "ash/keyboard/ui/keyboard_ui_factory.h"
#include "ash/login/login_screen_controller.h" #include "ash/login/login_screen_controller.h"
...@@ -540,6 +541,8 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate) ...@@ -540,6 +541,8 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate)
focus_cycler_(std::make_unique<FocusCycler>()), focus_cycler_(std::make_unique<FocusCycler>()),
ime_controller_(std::make_unique<ImeControllerImpl>()), ime_controller_(std::make_unique<ImeControllerImpl>()),
immersive_context_(std::make_unique<ImmersiveContextAsh>()), immersive_context_(std::make_unique<ImmersiveContextAsh>()),
in_session_auth_dialog_controller_(
std::make_unique<InSessionAuthDialogControllerImpl>()),
keyboard_brightness_control_delegate_( keyboard_brightness_control_delegate_(
std::make_unique<KeyboardBrightnessController>()), std::make_unique<KeyboardBrightnessController>()),
locale_update_controller_(std::make_unique<LocaleUpdateControllerImpl>()), locale_update_controller_(std::make_unique<LocaleUpdateControllerImpl>()),
......
...@@ -121,6 +121,7 @@ class HoldingSpaceController; ...@@ -121,6 +121,7 @@ class HoldingSpaceController;
class HomeScreenController; class HomeScreenController;
class ImeControllerImpl; class ImeControllerImpl;
class ImmersiveContext; class ImmersiveContext;
class InSessionAuthDialogControllerImpl;
class KeyAccessibilityEnabler; class KeyAccessibilityEnabler;
class KeyboardBrightnessControlDelegate; class KeyboardBrightnessControlDelegate;
class KeyboardControllerImpl; class KeyboardControllerImpl;
...@@ -385,6 +386,9 @@ class ASH_EXPORT Shell : public SessionObserver, ...@@ -385,6 +386,9 @@ class ASH_EXPORT Shell : public SessionObserver,
return high_contrast_controller_.get(); return high_contrast_controller_.get();
} }
ImeControllerImpl* ime_controller() { return ime_controller_.get(); } ImeControllerImpl* ime_controller() { return ime_controller_.get(); }
InSessionAuthDialogControllerImpl* in_session_auth_dialog_controller() {
return in_session_auth_dialog_controller_.get();
}
KeyAccessibilityEnabler* key_accessibility_enabler() { KeyAccessibilityEnabler* key_accessibility_enabler() {
return key_accessibility_enabler_.get(); return key_accessibility_enabler_.get();
} }
...@@ -675,6 +679,8 @@ class ASH_EXPORT Shell : public SessionObserver, ...@@ -675,6 +679,8 @@ class ASH_EXPORT Shell : public SessionObserver,
std::unique_ptr<HomeScreenController> home_screen_controller_; std::unique_ptr<HomeScreenController> home_screen_controller_;
std::unique_ptr<ImeControllerImpl> ime_controller_; std::unique_ptr<ImeControllerImpl> ime_controller_;
std::unique_ptr<ImmersiveContext> immersive_context_; std::unique_ptr<ImmersiveContext> immersive_context_;
std::unique_ptr<InSessionAuthDialogControllerImpl>
in_session_auth_dialog_controller_;
std::unique_ptr<KeyboardBrightnessControlDelegate> std::unique_ptr<KeyboardBrightnessControlDelegate>
keyboard_brightness_control_delegate_; keyboard_brightness_control_delegate_;
std::unique_ptr<LocaleUpdateControllerImpl> locale_update_controller_; std::unique_ptr<LocaleUpdateControllerImpl> locale_update_controller_;
......
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