OLD | NEW |
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/base/ui_features.h" |
9 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
10 #include "ui/gfx/paint_vector_icon.h" | 11 #include "ui/gfx/paint_vector_icon.h" |
11 #include "ui/gfx/vector_icons_public.h" | 12 #include "ui/gfx/vector_icons_public.h" |
12 #include "ui/resources/grit/ui_resources.h" | 13 #include "ui/resources/grit/ui_resources.h" |
13 #include "ui/views/controls/button/label_button.h" | 14 #include "ui/views/controls/button/label_button.h" |
14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" | 15 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" |
15 | 16 |
16 #import <Cocoa/Cocoa.h> | 17 #import <Cocoa/Cocoa.h> |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
20 const int PlatformStyle::kComboboxNormalArrowPadding = 0; | 21 const int PlatformStyle::kComboboxNormalArrowPadding = 0; |
21 const int PlatformStyle::kMinLabelButtonWidth = 32; | 22 const int PlatformStyle::kMinLabelButtonWidth = 32; |
22 const int PlatformStyle::kMinLabelButtonHeight = 30; | 23 const int PlatformStyle::kMinLabelButtonHeight = 30; |
23 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; | 24 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; |
24 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; | 25 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; |
25 const bool PlatformStyle::kTextDragVerticallyDragsToEnd = true; | 26 const bool PlatformStyle::kTextDragVerticallyDragsToEnd = true; |
26 const bool PlatformStyle::kTreeViewHasFocusRing = true; | 27 const bool PlatformStyle::kTreeViewHasFocusRing = true; |
27 const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; | 28 const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; |
28 const bool PlatformStyle::kUseRipples = false; | 29 const bool PlatformStyle::kUseRipples = false; |
29 | 30 |
| 31 // On Mac, the Cocoa browser window does not flip its UI in RTL (e.g. bookmark |
| 32 // star remains on the right, padlock on the left). So bubbles should open in |
| 33 // the same direction as in LTR by default, unless the entire browser is views. |
| 34 const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault = |
| 35 BUILDFLAG(MAC_VIEWS_BROWSER); |
| 36 |
30 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction = | 37 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction = |
31 CustomButton::NOTIFY_ON_PRESS; | 38 CustomButton::NOTIFY_ON_PRESS; |
32 | 39 |
33 // static | 40 // static |
34 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, | 41 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, |
35 Combobox::Style style) { | 42 Combobox::Style style) { |
36 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't | 43 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't |
37 // look right on Mac. See https://crbug.com/384071. | 44 // look right on Mac. See https://crbug.com/384071. |
38 if (style == Combobox::STYLE_ACTION) { | 45 if (style == Combobox::STYLE_ACTION) { |
39 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 46 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ButtonColorByState& colors = *color_by_state; | 78 ButtonColorByState& colors = *color_by_state; |
72 colors[Button::STATE_PRESSED] = SK_ColorWHITE; | 79 colors[Button::STATE_PRESSED] = SK_ColorWHITE; |
73 } | 80 } |
74 | 81 |
75 // static | 82 // static |
76 void PlatformStyle::OnTextfieldEditFailed() { | 83 void PlatformStyle::OnTextfieldEditFailed() { |
77 NSBeep(); | 84 NSBeep(); |
78 } | 85 } |
79 | 86 |
80 } // namespace views | 87 } // namespace views |
OLD | NEW |