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

Side by Side Diff: ui/views/style/platform_style_mac.mm

Issue 2358913006: views: remove PlatformStyle::CreateLabelButtonBorder (Closed)
Patch Set: remove DialogButtonBorderMac too Created 4 years, 2 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/views/style/platform_style.cc ('k') | no next file » | 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/style/platform_style.h" 5 #include "ui/views/style/platform_style.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
10 #include "ui/gfx/paint_vector_icon.h" 10 #include "ui/gfx/paint_vector_icon.h"
11 #include "ui/gfx/vector_icons_public.h" 11 #include "ui/gfx/vector_icons_public.h"
12 #include "ui/resources/grit/ui_resources.h" 12 #include "ui/resources/grit/ui_resources.h"
13 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
14 #include "ui/views/controls/button/label_button_border.h"
15 #include "ui/views/controls/focusable_rounded_border_mac.h" 14 #include "ui/views/controls/focusable_rounded_border_mac.h"
16 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" 15 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h"
17 #include "ui/views/style/mac/combobox_background_mac.h" 16 #include "ui/views/style/mac/combobox_background_mac.h"
18 #include "ui/views/style/mac/dialog_button_border_mac.h"
19 17
20 #import <Cocoa/Cocoa.h> 18 #import <Cocoa/Cocoa.h>
21 19
22 namespace views { 20 namespace views {
23 21
24 const int PlatformStyle::kComboboxNormalArrowPadding = 0; 22 const int PlatformStyle::kComboboxNormalArrowPadding = 0;
25 const int PlatformStyle::kMinLabelButtonWidth = 32; 23 const int PlatformStyle::kMinLabelButtonWidth = 32;
26 const int PlatformStyle::kMinLabelButtonHeight = 30; 24 const int PlatformStyle::kMinLabelButtonHeight = 30;
27 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; 25 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false;
28 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; 26 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false;
(...skipping 25 matching lines...) Expand all
54 return base::WrapUnique(new FocusableRoundedBorder); 52 return base::WrapUnique(new FocusableRoundedBorder);
55 } 53 }
56 54
57 // static 55 // static
58 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground( 56 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
59 int shoulder_width) { 57 int shoulder_width) {
60 return base::MakeUnique<ComboboxBackgroundMac>(shoulder_width); 58 return base::MakeUnique<ComboboxBackgroundMac>(shoulder_width);
61 } 59 }
62 60
63 // static 61 // static
64 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
65 Button::ButtonStyle style) {
66 if (style == Button::STYLE_BUTTON)
67 return base::MakeUnique<DialogButtonBorderMac>();
68
69 return base::MakeUnique<LabelButtonAssetBorder>(style);
70 }
71
72 // static
73 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 62 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
74 return base::MakeUnique<CocoaScrollBar>(is_horizontal); 63 return base::MakeUnique<CocoaScrollBar>(is_horizontal);
75 } 64 }
76 65
77 // static 66 // static
78 SkColor PlatformStyle::TextColorForButton( 67 SkColor PlatformStyle::TextColorForButton(
79 const ButtonColorByState& color_by_state, 68 const ButtonColorByState& color_by_state,
80 const LabelButton& button) { 69 const LabelButton& button) {
81 Button::ButtonState state = button.state(); 70 Button::ButtonState state = button.state();
82 if (button.style() == Button::STYLE_BUTTON && 71 if (button.style() == Button::STYLE_BUTTON && button.is_default()) {
83 DialogButtonBorderMac::ShouldRenderDefault(button)) {
84 // For convenience, we currently assume Mac wants the color corresponding to 72 // For convenience, we currently assume Mac wants the color corresponding to
85 // the pressed state for default buttons. 73 // the pressed state for default buttons.
86 state = Button::STATE_PRESSED; 74 state = Button::STATE_PRESSED;
87 } 75 }
88 return color_by_state[state]; 76 return color_by_state[state];
89 } 77 }
90 78
91 // static 79 // static
92 void PlatformStyle::ApplyLabelButtonTextStyle( 80 void PlatformStyle::ApplyLabelButtonTextStyle(
93 views::Label* label, 81 views::Label* label,
94 ButtonColorByState* color_by_state) { 82 ButtonColorByState* color_by_state) {
95 const ui::NativeTheme* theme = label->GetNativeTheme(); 83 const ui::NativeTheme* theme = label->GetNativeTheme();
96 ButtonColorByState& colors = *color_by_state; 84 ButtonColorByState& colors = *color_by_state;
97 colors[Button::STATE_PRESSED] = 85 colors[Button::STATE_PRESSED] =
98 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); 86 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor);
99 } 87 }
100 88
101 // static 89 // static
102 void PlatformStyle::OnTextfieldKeypressUnhandled() { 90 void PlatformStyle::OnTextfieldKeypressUnhandled() {
103 NSBeep(); 91 NSBeep();
104 } 92 }
105 93
106 } // namespace views 94 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/style/platform_style.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698