Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3692)

Unified Diff: chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc

Issue 1990213003: Add "Sign In" button to the account chooser on Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/passwords/account_chooser_dialog_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
index a98dc5c35fd529b0f35f58272a3429b4adda9544..efaa781654d5d54a2a7a58119c2f39462c8c2011 100644
--- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
+++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
@@ -99,7 +99,8 @@ AccountChooserDialogView::AccountChooserDialogView(
PasswordDialogController* controller,
content::WebContents* web_contents)
: controller_(controller),
- web_contents_(web_contents) {
+ web_contents_(web_contents),
+ show_signin_button_(false) {
DCHECK(controller);
DCHECK(web_contents);
}
@@ -107,6 +108,7 @@ AccountChooserDialogView::AccountChooserDialogView(
AccountChooserDialogView::~AccountChooserDialogView() = default;
void AccountChooserDialogView::ShowAccountChooser() {
+ show_signin_button_ = controller_->ShouldShowSignInButton();
InitWindow();
constrained_window::ShowWebModalDialogViews(this, web_contents_);
}
@@ -138,13 +140,34 @@ void AccountChooserDialogView::WindowClosing() {
controller_->OnCloseDialog();
}
+bool AccountChooserDialogView::Accept() {
+ DCHECK(show_signin_button_);
+ DCHECK(controller_);
+ controller_->OnSignInClicked();
+ // The dialog is closed by the controller.
+ return false;
+}
+
int AccountChooserDialogView::GetDialogButtons() const {
+ if (show_signin_button_)
+ return ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK;
return ui::DIALOG_BUTTON_CANCEL;
}
+bool AccountChooserDialogView::ShouldDefaultButtonBeBlue() const {
+ return show_signin_button_;
+}
+
base::string16 AccountChooserDialogView::GetDialogButtonLabel(
ui::DialogButton button) const {
- return l10n_util::GetStringUTF16(IDS_APP_CANCEL);
+ int message_id = 0;
+ if (button == ui::DIALOG_BUTTON_OK)
+ message_id = IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_SIGN_IN;
+ else if (button == ui::DIALOG_BUTTON_CANCEL)
+ message_id = IDS_APP_CANCEL;
+ else
+ NOTREACHED();
+ return l10n_util::GetStringUTF16(message_id);
}
gfx::Size AccountChooserDialogView::GetPreferredSize() const {
« no previous file with comments | « chrome/browser/ui/views/passwords/account_chooser_dialog_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698