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

Side by Side Diff: ui/views/style/platform_style.cc

Issue 1904753002: MenuButton: support Mac look & feel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cache arrow images Created 4 years, 7 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 "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 44 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
45 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 45 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
46 } 46 }
47 47
48 // static 48 // static
49 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 49 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
50 return base::WrapUnique(new FocusableBorder()); 50 return base::WrapUnique(new FocusableBorder());
51 } 51 }
52 52
53 // static 53 // static
54 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() { 54 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
55 int shoulder_width) {
55 return nullptr; 56 return nullptr;
56 } 57 }
57 58
58 // static 59 // static
60 std::unique_ptr<Background> PlatformStyle::CreateMenuButtonBackground(
61 int shoulder_width) {
62 return nullptr;
63 }
64
65 // static
66 std::unique_ptr<FocusableBorder> PlatformStyle::CreateMenuButtonBorder() {
67 return base::WrapUnique(new FocusableBorder());
68 }
69
70 // static
59 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 71 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
60 Button::ButtonStyle style) { 72 Button::ButtonStyle style) {
61 if (!ui::MaterialDesignController::IsModeMaterial() || 73 if (!ui::MaterialDesignController::IsModeMaterial() ||
62 style != Button::STYLE_TEXTBUTTON) { 74 style != Button::STYLE_TEXTBUTTON) {
63 return base::WrapUnique(new LabelButtonAssetBorder(style)); 75 return base::WrapUnique(new LabelButtonAssetBorder(style));
64 } 76 }
65 77
66 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder()); 78 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder());
67 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( 79 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
68 Button::STYLE_TEXTBUTTON)); 80 Button::STYLE_TEXTBUTTON));
69 return border; 81 return border;
70 } 82 }
71 83
72 // static 84 // static
85 gfx::ImageSkia PlatformStyle::CreateMenuButtonArrow(bool is_enabled) {
86 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
87 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
88 }
89
90 // static
73 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 91 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
74 return base::WrapUnique(new NativeScrollBar(is_horizontal)); 92 return base::WrapUnique(new NativeScrollBar(is_horizontal));
75 } 93 }
76 94
77 // static 95 // static
78 SkColor PlatformStyle::TextColorForButton( 96 SkColor PlatformStyle::TextColorForButton(
79 const ButtonColorByState& color_by_state, 97 const ButtonColorByState& color_by_state,
80 const LabelButton& button) { 98 const LabelButton& button) {
81 return color_by_state[button.state()]; 99 return color_by_state[button.state()];
82 } 100 }
(...skipping 21 matching lines...) Expand all
104 122
105 #if !defined(DESKTOP_LINUX) 123 #if !defined(DESKTOP_LINUX)
106 // static 124 // static
107 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder( 125 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder(
108 LabelButton* button) { 126 LabelButton* button) {
109 return button->CreateDefaultBorder(); 127 return button->CreateDefaultBorder();
110 } 128 }
111 #endif 129 #endif
112 130
113 } // namespace views 131 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698