Chromium Code Reviews| 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/gfx/paint_vector_icon.h" | 9 #include "ui/gfx/paint_vector_icon.h" |
| 10 #include "ui/gfx/vector_icons.h" | 10 #include "ui/gfx/vector_icons.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 31 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 32 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); | 32 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); |
| 33 } | 33 } |
| 34 const int kComboboxArrowWidth = 13; | 34 const int kComboboxArrowWidth = 13; |
| 35 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC, | 35 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC, |
| 36 kComboboxArrowWidth, | 36 kComboboxArrowWidth, |
| 37 is_enabled ? SK_ColorWHITE : SK_ColorBLACK); | 37 is_enabled ? SK_ColorWHITE : SK_ColorBLACK); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 gfx::ImageSkia PlatformStyle::CreateMenuButtonArrow(bool is_enabled) { | |
| 42 const int kComboboxArrowWidth = 13; | |
|
tapted
2016/04/21 06:06:46
kMenuButtonArrowWidth
Elly Fong-Jones
2016/04/21 15:30:27
Done.
| |
| 43 return gfx::CreateVectorIcon(gfx::VectorIconId::MENU_BUTTON_ARROW_MAC, | |
| 44 kComboboxArrowWidth, | |
| 45 is_enabled ? SK_ColorWHITE : SK_ColorBLACK); | |
| 46 } | |
| 47 | |
| 48 // static | |
| 41 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { | 49 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { |
| 42 return base::WrapUnique(new FocusableRoundedBorder); | 50 return base::WrapUnique(new FocusableRoundedBorder); |
| 43 } | 51 } |
| 44 | 52 |
| 45 // static | 53 // static |
| 46 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() { | 54 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() { |
| 47 return base::WrapUnique(new ComboboxBackgroundMac); | 55 return base::WrapUnique( |
| 56 new ComboboxBackgroundMac(GetComboboxArrowWidth(Combobox::STYLE_NORMAL))); | |
|
tapted
2016/04/21 06:06:46
comment above about why STYLE_NORMAL is right here
Elly Fong-Jones
2016/04/21 15:30:27
It's only okay because of an implementation detail
| |
| 48 } | 57 } |
| 49 | 58 |
| 50 // static | 59 // static |
| 60 std::unique_ptr<FocusableBorder> PlatformStyle::CreateMenuButtonBorder() { | |
| 61 return base::WrapUnique(new FocusableRoundedBorder); | |
| 62 } | |
| 63 | |
| 64 // static | |
| 65 std::unique_ptr<Background> PlatformStyle::CreateMenuButtonBackground() { | |
| 66 return base::WrapUnique(new ComboboxBackgroundMac(GetMenuButtonArrowWidth())); | |
| 67 } | |
| 68 | |
| 69 // static | |
| 51 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( | 70 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( |
| 52 Button::ButtonStyle style) { | 71 Button::ButtonStyle style) { |
| 53 if (style == Button::STYLE_BUTTON) | 72 if (style == Button::STYLE_BUTTON) |
| 54 return base::WrapUnique(new DialogButtonBorderMac()); | 73 return base::WrapUnique(new DialogButtonBorderMac()); |
| 55 | 74 |
| 56 return base::WrapUnique(new LabelButtonAssetBorder(style)); | 75 return base::WrapUnique(new LabelButtonAssetBorder(style)); |
| 57 } | 76 } |
| 58 | 77 |
| 59 // static | 78 // static |
| 60 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { | 79 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 79 void PlatformStyle::ApplyLabelButtonTextStyle( | 98 void PlatformStyle::ApplyLabelButtonTextStyle( |
| 80 views::Label* label, | 99 views::Label* label, |
| 81 ButtonColorByState* color_by_state) { | 100 ButtonColorByState* color_by_state) { |
| 82 const ui::NativeTheme* theme = label->GetNativeTheme(); | 101 const ui::NativeTheme* theme = label->GetNativeTheme(); |
| 83 ButtonColorByState& colors = *color_by_state; | 102 ButtonColorByState& colors = *color_by_state; |
| 84 colors[Button::STATE_PRESSED] = | 103 colors[Button::STATE_PRESSED] = |
| 85 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); | 104 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); |
| 86 } | 105 } |
| 87 | 106 |
| 88 } // namespace views | 107 } // namespace views |
| OLD | NEW |