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

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

Issue 2826313006: views: remove PlatformStyle combobox hooks (Closed)
Patch Set: Created 3 years, 8 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
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"
9 #include "ui/base/ui_features.h" 8 #include "ui/base/ui_features.h"
10 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
11 #include "ui/gfx/paint_vector_icon.h"
12 #include "ui/resources/grit/ui_resources.h"
13 #include "ui/views/controls/button/label_button.h" 10 #include "ui/views/controls/button/label_button.h"
14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" 11 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h"
15 #include "ui/views/vector_icons.h"
16 12
17 #import <Cocoa/Cocoa.h> 13 #import <Cocoa/Cocoa.h>
18 14
19 namespace views { 15 namespace views {
20 16
21 const int PlatformStyle::kComboboxNormalArrowPadding = 0;
22 const int PlatformStyle::kMinLabelButtonWidth = 32; 17 const int PlatformStyle::kMinLabelButtonWidth = 32;
23 const int PlatformStyle::kMinLabelButtonHeight = 30; 18 const int PlatformStyle::kMinLabelButtonHeight = 30;
24 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; 19 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false;
25 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; 20 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false;
26 const bool PlatformStyle::kSelectWordOnRightClick = true; 21 const bool PlatformStyle::kSelectWordOnRightClick = true;
27 const bool PlatformStyle::kSelectAllOnRightClickWhenUnfocused = true; 22 const bool PlatformStyle::kSelectAllOnRightClickWhenUnfocused = true;
28 const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; 23 const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true;
29 const bool PlatformStyle::kTreeViewUsesOpenIcon = false; 24 const bool PlatformStyle::kTreeViewUsesOpenIcon = false;
30 const bool PlatformStyle::kUseRipples = false; 25 const bool PlatformStyle::kUseRipples = false;
31 26
32 // On Mac, the Cocoa browser window does not flip its UI in RTL (e.g. bookmark 27 // On Mac, the Cocoa browser window does not flip its UI in RTL (e.g. bookmark
33 // star remains on the right, padlock on the left). So bubbles should open in 28 // star remains on the right, padlock on the left). So bubbles should open in
34 // the same direction as in LTR by default, unless the entire browser is views. 29 // the same direction as in LTR by default, unless the entire browser is views.
35 const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault = 30 const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault =
36 BUILDFLAG(MAC_VIEWS_BROWSER); 31 BUILDFLAG(MAC_VIEWS_BROWSER);
37 32
38 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction = 33 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction =
39 CustomButton::NOTIFY_ON_PRESS; 34 CustomButton::NOTIFY_ON_PRESS;
40 35
41 const CustomButton::KeyClickAction PlatformStyle::kKeyClickActionOnSpace = 36 const CustomButton::KeyClickAction PlatformStyle::kKeyClickActionOnSpace =
42 CustomButton::CLICK_ON_KEY_PRESS; 37 CustomButton::CLICK_ON_KEY_PRESS;
43 38
44 // On Mac, the Return key is used to perform the default action even when a 39 // On Mac, the Return key is used to perform the default action even when a
45 // control is focused. 40 // control is focused.
46 const bool PlatformStyle::kReturnClicksFocusedControl = false; 41 const bool PlatformStyle::kReturnClicksFocusedControl = false;
47 42
48 // static 43 // static
49 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled,
50 Combobox::Style style) {
51 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't
52 // look right on Mac. See https://crbug.com/384071.
53 if (style == Combobox::STYLE_ACTION) {
54 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
55 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
56 }
57 const int kComboboxArrowWidth = 24;
58 return gfx::CreateVectorIcon(
59 is_enabled ? kComboboxArrowMacEnabledIcon : kComboboxArrowMacDisabledIcon,
tapted 2017/04/21 00:31:10 Can these two .icon files be deleted as well?
Elly Fong-Jones 2017/04/21 15:23:24 Yep!
60 kComboboxArrowWidth, SK_ColorBLACK);
61 }
62
63 // static
64 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 44 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
65 return base::MakeUnique<CocoaScrollBar>(is_horizontal); 45 return base::MakeUnique<CocoaScrollBar>(is_horizontal);
66 } 46 }
67 47
68 // static 48 // static
69 SkColor PlatformStyle::TextColorForButton( 49 SkColor PlatformStyle::TextColorForButton(
70 const ButtonColorByState& color_by_state, 50 const ButtonColorByState& color_by_state,
71 const LabelButton& button) { 51 const LabelButton& button) {
72 Button::ButtonState state = button.state(); 52 Button::ButtonState state = button.state();
73 if (button.style() == Button::STYLE_BUTTON && button.is_default()) { 53 if (button.style() == Button::STYLE_BUTTON && button.is_default()) {
(...skipping 11 matching lines...) Expand all
85 ButtonColorByState& colors = *color_by_state; 65 ButtonColorByState& colors = *color_by_state;
86 colors[Button::STATE_PRESSED] = SK_ColorWHITE; 66 colors[Button::STATE_PRESSED] = SK_ColorWHITE;
87 } 67 }
88 68
89 // static 69 // static
90 void PlatformStyle::OnTextfieldEditFailed() { 70 void PlatformStyle::OnTextfieldEditFailed() {
91 NSBeep(); 71 NSBeep();
92 } 72 }
93 73
94 } // namespace views 74 } // namespace views
OLDNEW
« ui/views/controls/combobox/combobox.cc ('K') | « ui/views/style/platform_style.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698