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

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

Issue 2391393002: Harmony - Use FocusableBorder for comboboxes on Mac (Closed)
Patch Set: fix mac 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/focusable_rounded_border_mac.h"
15 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" 14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h"
16 #include "ui/views/style/mac/combobox_background_mac.h"
17 15
18 #import <Cocoa/Cocoa.h> 16 #import <Cocoa/Cocoa.h>
19 17
20 namespace views { 18 namespace views {
21 19
22 const int PlatformStyle::kComboboxNormalArrowPadding = 0; 20 const int PlatformStyle::kComboboxNormalArrowPadding = 0;
23 const int PlatformStyle::kMinLabelButtonWidth = 32; 21 const int PlatformStyle::kMinLabelButtonWidth = 32;
24 const int PlatformStyle::kMinLabelButtonHeight = 30; 22 const int PlatformStyle::kMinLabelButtonHeight = 30;
25 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; 23 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false;
26 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; 24 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false;
(...skipping 14 matching lines...) Expand all
41 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 39 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
42 } 40 }
43 const int kComboboxArrowWidth = 24; 41 const int kComboboxArrowWidth = 24;
44 return gfx::CreateVectorIcon( 42 return gfx::CreateVectorIcon(
45 is_enabled ? gfx::VectorIconId::COMBOBOX_ARROW_MAC_ENABLED 43 is_enabled ? gfx::VectorIconId::COMBOBOX_ARROW_MAC_ENABLED
46 : gfx::VectorIconId::COMBOBOX_ARROW_MAC_DISABLED, 44 : gfx::VectorIconId::COMBOBOX_ARROW_MAC_DISABLED,
47 kComboboxArrowWidth, SK_ColorBLACK); 45 kComboboxArrowWidth, SK_ColorBLACK);
48 } 46 }
49 47
50 // static 48 // static
51 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
52 return base::WrapUnique(new FocusableRoundedBorder);
53 }
54
55 // static
56 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
57 int shoulder_width) {
58 return base::MakeUnique<ComboboxBackgroundMac>(shoulder_width);
59 }
60
61 // static
62 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 49 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
63 return base::MakeUnique<CocoaScrollBar>(is_horizontal); 50 return base::MakeUnique<CocoaScrollBar>(is_horizontal);
64 } 51 }
65 52
66 // static 53 // static
67 SkColor PlatformStyle::TextColorForButton( 54 SkColor PlatformStyle::TextColorForButton(
68 const ButtonColorByState& color_by_state, 55 const ButtonColorByState& color_by_state,
69 const LabelButton& button) { 56 const LabelButton& button) {
70 Button::ButtonState state = button.state(); 57 Button::ButtonState state = button.state();
71 if (button.style() == Button::STYLE_BUTTON && button.is_default()) { 58 if (button.style() == Button::STYLE_BUTTON && button.is_default()) {
(...skipping 11 matching lines...) Expand all
83 ButtonColorByState& colors = *color_by_state; 70 ButtonColorByState& colors = *color_by_state;
84 colors[Button::STATE_PRESSED] = SK_ColorWHITE; 71 colors[Button::STATE_PRESSED] = SK_ColorWHITE;
85 } 72 }
86 73
87 // static 74 // static
88 void PlatformStyle::OnTextfieldEditFailed() { 75 void PlatformStyle::OnTextfieldEditFailed() {
89 NSBeep(); 76 NSBeep();
90 } 77 }
91 78
92 } // namespace views 79 } // 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