Commit 68ca806f authored by Roman Sorokin's avatar Roman Sorokin Committed by Chromium LUCI CQ

OOBE: Nuke ResetSigninScreenHandlerDelegate

Small cleanup

Bug: none
Change-Id: Ifce493d3c876fa1d067900fe8cba00c77582fb26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563462
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Auto-Submit: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832355}
parent 3df0b847
...@@ -460,6 +460,9 @@ LoginDisplayHostWebUI::LoginDisplayHostWebUI() ...@@ -460,6 +460,9 @@ LoginDisplayHostWebUI::LoginDisplayHostWebUI()
} }
LoginDisplayHostWebUI::~LoginDisplayHostWebUI() { LoginDisplayHostWebUI::~LoginDisplayHostWebUI() {
if (GetOobeUI())
GetOobeUI()->signin_screen_handler()->SetDelegate(nullptr);
SessionManagerClient::Get()->RemoveObserver(this); SessionManagerClient::Get()->RemoveObserver(this);
CrasAudioHandler::Get()->RemoveAudioObserver(this); CrasAudioHandler::Get()->RemoveAudioObserver(this);
display::Screen::GetScreen()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this);
...@@ -818,7 +821,7 @@ void LoginDisplayHostWebUI::OnWillRemoveView(views::Widget* widget, ...@@ -818,7 +821,7 @@ void LoginDisplayHostWebUI::OnWillRemoveView(views::Widget* widget,
views::View* view) { views::View* view) {
if (view != static_cast<views::View*>(login_view_)) if (view != static_cast<views::View*>(login_view_))
return; return;
login_view_ = nullptr; ResetLoginView();
widget->RemoveRemovalsObserver(this); widget->RemoveRemovalsObserver(this);
} }
...@@ -830,7 +833,7 @@ void LoginDisplayHostWebUI::OnWidgetDestroying(views::Widget* widget) { ...@@ -830,7 +833,7 @@ void LoginDisplayHostWebUI::OnWidgetDestroying(views::Widget* widget) {
login_window_->RemoveObserver(this); login_window_->RemoveObserver(this);
login_window_ = nullptr; login_window_ = nullptr;
login_view_ = nullptr; ResetLoginView();
} }
void LoginDisplayHostWebUI::OnWidgetBoundsChanged(views::Widget* widget, void LoginDisplayHostWebUI::OnWidgetBoundsChanged(views::Widget* widget,
...@@ -949,7 +952,7 @@ void LoginDisplayHostWebUI::ResetLoginWindowAndView() { ...@@ -949,7 +952,7 @@ void LoginDisplayHostWebUI::ResetLoginWindowAndView() {
// `login_view_` pointer. // `login_view_` pointer.
if (login_view_) { if (login_view_) {
login_view_->SetUIEnabled(true); login_view_->SetUIEnabled(true);
login_view_ = nullptr; ResetLoginView();
} }
if (login_window_) { if (login_window_) {
...@@ -976,6 +979,17 @@ void LoginDisplayHostWebUI::TryToPlayOobeStartupSound() { ...@@ -976,6 +979,17 @@ void LoginDisplayHostWebUI::TryToPlayOobeStartupSound() {
PlayStartupSoundIfPossible(); PlayStartupSoundIfPossible();
} }
void LoginDisplayHostWebUI::ResetLoginView() {
if (!login_view_)
return;
OobeUI* oobe_ui = login_view_->GetOobeUI();
if (oobe_ui)
oobe_ui->signin_screen_handler()->SetDelegate(nullptr);
login_view_ = nullptr;
}
void LoginDisplayHostWebUI::OnLoginPromptVisible() { void LoginDisplayHostWebUI::OnLoginPromptVisible() {
if (!login_prompt_visible_time_.is_null()) if (!login_prompt_visible_time_.is_null())
return; return;
......
...@@ -199,6 +199,9 @@ class LoginDisplayHostWebUI : public LoginDisplayHostCommon, ...@@ -199,6 +199,9 @@ class LoginDisplayHostWebUI : public LoginDisplayHostCommon,
// Plays startup sound if needed and audio device is ready. // Plays startup sound if needed and audio device is ready.
void PlayStartupSoundIfPossible(); void PlayStartupSoundIfPossible();
// Resets login view and unbinds login display from the signin screen handler.
void ResetLoginView();
// Sign in screen controller. // Sign in screen controller.
std::unique_ptr<ExistingUserController> existing_user_controller_; std::unique_ptr<ExistingUserController> existing_user_controller_;
......
...@@ -34,8 +34,6 @@ namespace chromeos { ...@@ -34,8 +34,6 @@ namespace chromeos {
// LoginDisplayWebUI, public: -------------------------------------------------- // LoginDisplayWebUI, public: --------------------------------------------------
LoginDisplayWebUI::~LoginDisplayWebUI() { LoginDisplayWebUI::~LoginDisplayWebUI() {
if (webui_handler_)
webui_handler_->ResetSigninScreenHandlerDelegate();
ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get();
if (activity_detector && activity_detector->HasObserver(this)) if (activity_detector && activity_detector->HasObserver(this))
activity_detector->RemoveObserver(this); activity_detector->RemoveObserver(this);
......
...@@ -806,10 +806,6 @@ void OobeUI::ForwardAccelerator(std::string accelerator_name) { ...@@ -806,10 +806,6 @@ void OobeUI::ForwardAccelerator(std::string accelerator_name) {
core_handler_->ForwardAccelerator(accelerator_name); core_handler_->ForwardAccelerator(accelerator_name);
} }
void OobeUI::ResetSigninScreenHandlerDelegate() {
signin_screen_handler_->SetDelegate(nullptr);
}
gfx::NativeView OobeUI::GetNativeView() { gfx::NativeView OobeUI::GetNativeView() {
return web_ui()->GetWebContents()->GetNativeView(); return web_ui()->GetWebContents()->GetNativeView();
} }
......
...@@ -94,9 +94,6 @@ class OobeUI : public ui::MojoWebUIController { ...@@ -94,9 +94,6 @@ class OobeUI : public ui::MojoWebUIController {
// Forwards an accelerator to the webui to be handled. // Forwards an accelerator to the webui to be handled.
void ForwardAccelerator(std::string accelerator_name); void ForwardAccelerator(std::string accelerator_name);
// Resets the delegate set in ShowSigninScreen.
void ResetSigninScreenHandlerDelegate();
gfx::NativeView GetNativeView(); gfx::NativeView GetNativeView();
gfx::NativeWindow GetTopLevelNativeWindow(); gfx::NativeWindow GetTopLevelNativeWindow();
......
...@@ -862,9 +862,6 @@ void SigninScreenHandler::OnPreferencesChanged() { ...@@ -862,9 +862,6 @@ void SigninScreenHandler::OnPreferencesChanged() {
} }
} }
void SigninScreenHandler::ResetSigninScreenHandlerDelegate() {
SetDelegate(nullptr);
}
void SigninScreenHandler::ShowError(int login_attempts, void SigninScreenHandler::ShowError(int login_attempts,
const std::string& error_text, const std::string& error_text,
......
...@@ -65,7 +65,6 @@ class LoginDisplayWebUIHandler { ...@@ -65,7 +65,6 @@ class LoginDisplayWebUIHandler {
virtual void ClearUserPodPassword() = 0; virtual void ClearUserPodPassword() = 0;
virtual void OnUserImageChanged(const user_manager::User& user) = 0; virtual void OnUserImageChanged(const user_manager::User& user) = 0;
virtual void OnPreferencesChanged() = 0; virtual void OnPreferencesChanged() = 0;
virtual void ResetSigninScreenHandlerDelegate() = 0;
virtual void ShowError(int login_attempts, virtual void ShowError(int login_attempts,
const std::string& error_text, const std::string& error_text,
const std::string& help_link_text, const std::string& help_link_text,
...@@ -227,7 +226,6 @@ class SigninScreenHandler ...@@ -227,7 +226,6 @@ class SigninScreenHandler
void ClearUserPodPassword() override; void ClearUserPodPassword() override;
void OnUserImageChanged(const user_manager::User& user) override; void OnUserImageChanged(const user_manager::User& user) override;
void OnPreferencesChanged() override; void OnPreferencesChanged() override;
void ResetSigninScreenHandlerDelegate() override;
void ShowError(int login_attempts, void ShowError(int login_attempts,
const std::string& error_text, const std::string& error_text,
const std::string& help_link_text, const std::string& help_link_text,
......
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