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

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: Add basic tests 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 45 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
46 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 46 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
47 } 47 }
48 48
49 // static 49 // static
50 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 50 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
51 return base::WrapUnique(new FocusableBorder()); 51 return base::WrapUnique(new FocusableBorder());
52 } 52 }
53 53
54 // static 54 // static
55 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() { 55 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
56 int shoulder_width) {
56 return nullptr; 57 return nullptr;
57 } 58 }
58 59
59 // static 60 // static
61 std::unique_ptr<Background> PlatformStyle::CreateMenuButtonBackground(
62 int shoulder_width) {
63 return nullptr;
64 }
65
66 // static
67 std::unique_ptr<FocusableBorder> PlatformStyle::CreateMenuButtonBorder() {
68 return base::WrapUnique(new FocusableBorder());
69 }
70
71 // static
60 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 72 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
61 Button::ButtonStyle style) { 73 Button::ButtonStyle style) {
62 if (!ui::MaterialDesignController::IsModeMaterial() || 74 if (!ui::MaterialDesignController::IsModeMaterial() ||
63 style != Button::STYLE_TEXTBUTTON) { 75 style != Button::STYLE_TEXTBUTTON) {
64 return base::WrapUnique(new LabelButtonAssetBorder(style)); 76 return base::WrapUnique(new LabelButtonAssetBorder(style));
65 } 77 }
66 78
67 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder()); 79 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder());
68 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( 80 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
69 Button::STYLE_TEXTBUTTON)); 81 Button::STYLE_TEXTBUTTON));
70 return border; 82 return border;
71 } 83 }
72 84
73 // static 85 // static
86 gfx::ImageSkia PlatformStyle::CreateMenuButtonArrow(bool is_enabled) {
87 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
88 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
89 }
90
91 // static
74 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 92 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
75 return base::WrapUnique(new NativeScrollBar(is_horizontal)); 93 return base::WrapUnique(new NativeScrollBar(is_horizontal));
76 } 94 }
77 95
78 // static 96 // static
79 SkColor PlatformStyle::TextColorForButton( 97 SkColor PlatformStyle::TextColorForButton(
80 const ButtonColorByState& color_by_state, 98 const ButtonColorByState& color_by_state,
81 const LabelButton& button) { 99 const LabelButton& button) {
82 return color_by_state[button.state()]; 100 return color_by_state[button.state()];
83 } 101 }
(...skipping 21 matching lines...) Expand all
105 123
106 #if !defined(DESKTOP_LINUX) 124 #if !defined(DESKTOP_LINUX)
107 // static 125 // static
108 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder( 126 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder(
109 LabelButton* button) { 127 LabelButton* button) {
110 return button->CreateDefaultBorder(); 128 return button->CreateDefaultBorder();
111 } 129 }
112 #endif 130 #endif
113 131
114 } // namespace views 132 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698