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

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 2615563003: MacViews: Ensure cancel buttons don't get default button styling. (Closed)
Patch Set: Created 3 years, 12 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index cf50c1c6182b6d613c33ac53ce8d0fbfa7feace7..82817517d4ee906b211c71e9a5da419330928b4c 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -15,6 +15,7 @@
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/layout/layout_constants.h"
+#include "ui/views/style/platform_style.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
@@ -322,10 +323,15 @@ void DialogClientView::ChildVisibilityChanged(View* child) {
LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
LabelButton* button = nullptr;
+
+ const bool is_default =
+ GetDialogDelegate()->GetDefaultDialogButton() == type &&
+ (type != ui::DIALOG_BUTTON_CANCEL ||
karandeepb 2017/01/04 07:46:51 This is similar to what we do in DialogDelegate::U
tapted 2017/01/04 23:11:40 IMO the nicer fix would be to merge the Blue/Regul
+ PlatformStyle::kDialogDefaultButtonCanBeCancel);
+
// The default button is always blue in Harmony.
- if (GetDialogDelegate()->GetDefaultDialogButton() == type &&
- (ui::MaterialDesignController::IsSecondaryUiMaterial() ||
- GetDialogDelegate()->ShouldDefaultButtonBeBlue())) {
+ if (is_default && (ui::MaterialDesignController::IsSecondaryUiMaterial() ||
+ GetDialogDelegate()->ShouldDefaultButtonBeBlue())) {
button = MdTextButton::CreateSecondaryUiBlueButton(this, title);
} else {
button = MdTextButton::CreateSecondaryUiButton(this, title);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698