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

Side by Side Diff: ui/views/controls/button/md_text_button.cc

Issue 2922263002: Fix style of profile error dialog. (Closed)
Patch Set: tapted's and pkasting's comments Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/base/models/dialog_model.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/md_text_button.h" 5 #include "ui/views/controls/button/md_text_button.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/views/controls/focus_ring.h" 21 #include "ui/views/controls/focus_ring.h"
22 #include "ui/views/layout/layout_provider.h" 22 #include "ui/views/layout/layout_provider.h"
23 #include "ui/views/painter.h" 23 #include "ui/views/painter.h"
24 #include "ui/views/style/platform_style.h" 24 #include "ui/views/style/platform_style.h"
25 #include "ui/views/style/typography.h" 25 #include "ui/views/style/typography.h"
26 26
27 namespace views { 27 namespace views {
28 28
29 namespace { 29 namespace {
30 30
31 bool UseMaterialSecondaryButtons() {
32 #if defined(OS_MACOSX)
33 return true;
34 #else
35 return ui::MaterialDesignController::IsSecondaryUiMaterial();
36 #endif // defined(OS_MACOSX)
37 }
38
31 LabelButton* CreateButton(ButtonListener* listener, 39 LabelButton* CreateButton(ButtonListener* listener,
32 const base::string16& text, 40 const base::string16& text,
33 bool md) { 41 bool md) {
34 if (md) 42 if (md)
35 return MdTextButton::Create(listener, text, style::CONTEXT_BUTTON_MD); 43 return MdTextButton::Create(listener, text, style::CONTEXT_BUTTON_MD);
36 44
37 LabelButton* button = new LabelButton(listener, text, style::CONTEXT_BUTTON); 45 LabelButton* button = new LabelButton(listener, text, style::CONTEXT_BUTTON);
38 button->SetStyleDeprecated(CustomButton::STYLE_BUTTON); 46 button->SetStyleDeprecated(CustomButton::STYLE_BUTTON);
39 return button; 47 return button;
40 } 48 }
41 49
42 } // namespace 50 } // namespace
43 51
44 // static 52 // static
45 LabelButton* MdTextButton::CreateSecondaryUiButton(ButtonListener* listener, 53 LabelButton* MdTextButton::CreateSecondaryUiButton(ButtonListener* listener,
46 const base::string16& text) { 54 const base::string16& text) {
47 return CreateButton(listener, text, 55 return CreateButton(listener, text, UseMaterialSecondaryButtons());
48 ui::MaterialDesignController::IsSecondaryUiMaterial());
49 } 56 }
50 57
51 // static 58 // static
52 LabelButton* MdTextButton::CreateSecondaryUiBlueButton( 59 LabelButton* MdTextButton::CreateSecondaryUiBlueButton(
53 ButtonListener* listener, 60 ButtonListener* listener,
54 const base::string16& text) { 61 const base::string16& text) {
55 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 62 if (UseMaterialSecondaryButtons()) {
56 MdTextButton* md_button = 63 MdTextButton* md_button =
57 MdTextButton::Create(listener, text, style::CONTEXT_BUTTON_MD); 64 MdTextButton::Create(listener, text, style::CONTEXT_BUTTON_MD);
58 md_button->SetProminent(true); 65 md_button->SetProminent(true);
59 return md_button; 66 return md_button;
60 } 67 }
61 68
62 return new BlueButton(listener, text); 69 return new BlueButton(listener, text);
63 } 70 }
64 71
65 // static 72 // static
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 290 }
284 291
285 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); 292 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
286 SetBackground( 293 SetBackground(
287 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter( 294 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter(
288 bg_color, stroke_color, kInkDropSmallCornerRadius))); 295 bg_color, stroke_color, kInkDropSmallCornerRadius)));
289 SchedulePaint(); 296 SchedulePaint();
290 } 297 }
291 298
292 } // namespace views 299 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/models/dialog_model.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698