| 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/base/ui_features.h" |
| 10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| 11 #include "ui/gfx/paint_vector_icon.h" | 11 #include "ui/gfx/paint_vector_icon.h" |
| 12 #include "ui/gfx/vector_icons_public.h" | |
| 13 #include "ui/resources/grit/ui_resources.h" | 12 #include "ui/resources/grit/ui_resources.h" |
| 14 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
| 15 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" | 14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" |
| 15 #include "ui/views/resources/vector_icons/vector_icons.h" |
| 16 | 16 |
| 17 #import <Cocoa/Cocoa.h> | 17 #import <Cocoa/Cocoa.h> |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 | 20 |
| 21 const int PlatformStyle::kComboboxNormalArrowPadding = 0; | 21 const int PlatformStyle::kComboboxNormalArrowPadding = 0; |
| 22 const int PlatformStyle::kMinLabelButtonWidth = 32; | 22 const int PlatformStyle::kMinLabelButtonWidth = 32; |
| 23 const int PlatformStyle::kMinLabelButtonHeight = 30; | 23 const int PlatformStyle::kMinLabelButtonHeight = 30; |
| 24 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; | 24 const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = false; |
| 25 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; | 25 const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, | 48 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, |
| 49 Combobox::Style style) { | 49 Combobox::Style style) { |
| 50 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't | 50 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't |
| 51 // look right on Mac. See https://crbug.com/384071. | 51 // look right on Mac. See https://crbug.com/384071. |
| 52 if (style == Combobox::STYLE_ACTION) { | 52 if (style == Combobox::STYLE_ACTION) { |
| 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 54 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); | 54 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); |
| 55 } | 55 } |
| 56 const int kComboboxArrowWidth = 24; | 56 const int kComboboxArrowWidth = 24; |
| 57 return gfx::CreateVectorIcon( | 57 return gfx::CreateVectorIcon( |
| 58 is_enabled ? gfx::VectorIconId::COMBOBOX_ARROW_MAC_ENABLED | 58 is_enabled ? kComboboxArrowMacEnabledIcon : kComboboxArrowMacDisabledIcon, |
| 59 : gfx::VectorIconId::COMBOBOX_ARROW_MAC_DISABLED, | |
| 60 kComboboxArrowWidth, SK_ColorBLACK); | 59 kComboboxArrowWidth, SK_ColorBLACK); |
| 61 } | 60 } |
| 62 | 61 |
| 63 // static | 62 // static |
| 64 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { | 63 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { |
| 65 return base::MakeUnique<CocoaScrollBar>(is_horizontal); | 64 return base::MakeUnique<CocoaScrollBar>(is_horizontal); |
| 66 } | 65 } |
| 67 | 66 |
| 68 // static | 67 // static |
| 69 SkColor PlatformStyle::TextColorForButton( | 68 SkColor PlatformStyle::TextColorForButton( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 85 ButtonColorByState& colors = *color_by_state; | 84 ButtonColorByState& colors = *color_by_state; |
| 86 colors[Button::STATE_PRESSED] = SK_ColorWHITE; | 85 colors[Button::STATE_PRESSED] = SK_ColorWHITE; |
| 87 } | 86 } |
| 88 | 87 |
| 89 // static | 88 // static |
| 90 void PlatformStyle::OnTextfieldEditFailed() { | 89 void PlatformStyle::OnTextfieldEditFailed() { |
| 91 NSBeep(); | 90 NSBeep(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 } // namespace views | 93 } // namespace views |
| OLD | NEW |