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

Unified Diff: chrome/browser/ui/views/infobars/confirm_infobar.cc

Issue 1831673002: [MD] Apply appropriate call to action styling to infobar buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile Created 4 years, 9 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 | « no previous file | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/infobars/confirm_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc
index 2780bbf2096c6117581934a06109eae5e27b194a..d73d27c5382152c260369b9ab2fd25cd57f37ea1 100644
--- a/chrome/browser/ui/views/infobars/confirm_infobar.cc
+++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc
@@ -13,6 +13,7 @@
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/window_open_disposition.h"
#include "ui/views/controls/button/label_button.h"
+#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
@@ -70,8 +71,20 @@ void ConfirmInfoBar::ViewHierarchyChanged(
AddViewToContentArea(label_);
if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) {
- ok_button_ = CreateTextButton(
- this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ views::MdTextButton* button = CreateMdTextButton(
+ this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ // If this is the only button, weak call to action. Otherwise, strong
+ // call to action.
+ button->SetCallToAction(
+ delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_OK
+ ? views::MdTextButton::WEAK_CALL_TO_ACTION
+ : views::MdTextButton::STRONG_CALL_TO_ACTION);
+ ok_button_ = button;
+ } else {
+ ok_button_ = CreateTextButton(
+ this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ }
Peter Kasting 2016/03/25 04:57:48 Nit: It seems unfortunate to have this mostly-dupl
Evan Stade 2016/03/28 19:13:43 I don't see this as a huge win because I don't see
if (delegate->OKButtonTriggersUACPrompt()) {
elevation_icon_setter_.reset(new ElevationIconSetter(
ok_button_,
@@ -82,9 +95,22 @@ void ConfirmInfoBar::ViewHierarchyChanged(
}
if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
- cancel_button_ = CreateTextButton(
- this,
- delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ views::MdTextButton* button = CreateMdTextButton(
+ this,
+ delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ // If this is the only button, weak call to action. Otherwise, no call
+ // to action.
+ button->SetCallToAction(
+ delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_CANCEL
+ ? views::MdTextButton::WEAK_CALL_TO_ACTION
+ : views::MdTextButton::NO_CALL_TO_ACTION);
+ cancel_button_ = button;
+ } else {
+ cancel_button_ = CreateTextButton(
+ this,
+ delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ }
AddViewToContentArea(cancel_button_);
cancel_button_->SizeToPreferredSize();
}
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698