Commit 0661c73c authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Disallow creation of multiple InlineLoginHandlerDialogChromeOS dialogs

Chrome OS Account Manager : When users click on the "Add account"
button, a new account addition dialog should not be created if an
existing one is being displayed.

This dialog is always-on-top and creating multiple such dialogs clutters
the screen and is a bad user experience.

Instead, move focus to an existing account addition dialog, if available
when users click on "Add account" multiple times.

Bug: 833797
Test: Manually
Change-Id: I8a28d5d1d372f06d85cb6a5cd27d96f6ac25679a
Reviewed-on: https://chromium-review.googlesource.com/c/1308193
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604235}
parent 39c6fbea
......@@ -6,17 +6,29 @@
#include <string>
#include "base/logging.h"
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/common/webui_url_constants.h"
#include "ui/aura/window.h"
namespace chromeos {
namespace {
InlineLoginHandlerDialogChromeOS* dialog = nullptr;
} // namespace
// static
void InlineLoginHandlerDialogChromeOS::Show() {
if (dialog) {
dialog->dialog_window()->Focus();
return;
}
// Will be deleted by |SystemWebDialogDelegate::OnDialogClosed|.
InlineLoginHandlerDialogChromeOS* dialog =
new InlineLoginHandlerDialogChromeOS();
dialog = new InlineLoginHandlerDialogChromeOS();
dialog->ShowSystemDialog(false /* is_minimal_style */);
}
......@@ -24,7 +36,10 @@ InlineLoginHandlerDialogChromeOS::InlineLoginHandlerDialogChromeOS()
: SystemWebDialogDelegate(GURL(chrome::kChromeUIChromeSigninURL),
base::string16() /* title */) {}
InlineLoginHandlerDialogChromeOS::~InlineLoginHandlerDialogChromeOS() = default;
InlineLoginHandlerDialogChromeOS::~InlineLoginHandlerDialogChromeOS() {
DCHECK_EQ(this, dialog);
dialog = nullptr;
}
std::string InlineLoginHandlerDialogChromeOS::GetDialogArgs() const {
return std::string();
......
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