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 "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 Loading... |
45 | 45 |
46 // static | 46 // static |
47 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, | 47 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled, |
48 Combobox::Style style) { | 48 Combobox::Style style) { |
49 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 49 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
50 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); | 50 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); |
51 } | 51 } |
52 | 52 |
53 // static | 53 // static |
54 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { | 54 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { |
55 return base::WrapUnique(new FocusableBorder()); | 55 return base::MakeUnique<FocusableBorder>(); |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground( | 59 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground( |
60 int shoulder_width) { | 60 int shoulder_width) { |
61 return nullptr; | 61 return nullptr; |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( | 65 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( |
66 Button::ButtonStyle style) { | 66 Button::ButtonStyle style) { |
67 if (!ui::MaterialDesignController::IsModeMaterial() || | 67 if (!ui::MaterialDesignController::IsModeMaterial() || |
68 style != Button::STYLE_TEXTBUTTON) { | 68 style != Button::STYLE_TEXTBUTTON) { |
69 return base::WrapUnique(new LabelButtonAssetBorder(style)); | 69 return base::MakeUnique<LabelButtonAssetBorder>(style); |
70 } | 70 } |
71 | 71 |
72 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder()); | 72 std::unique_ptr<LabelButtonBorder> border(new views::LabelButtonBorder()); |
73 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( | 73 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( |
74 Button::STYLE_TEXTBUTTON)); | 74 Button::STYLE_TEXTBUTTON)); |
75 return border; | 75 return border; |
76 } | 76 } |
77 | 77 |
78 // static | 78 // static |
79 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { | 79 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { |
80 return base::WrapUnique(new NativeScrollBar(is_horizontal)); | 80 return base::MakeUnique<NativeScrollBar>(is_horizontal); |
81 } | 81 } |
82 | 82 |
83 // static | 83 // static |
84 SkColor PlatformStyle::TextColorForButton( | 84 SkColor PlatformStyle::TextColorForButton( |
85 const ButtonColorByState& color_by_state, | 85 const ButtonColorByState& color_by_state, |
86 const LabelButton& button) { | 86 const LabelButton& button) { |
87 return color_by_state[button.state()]; | 87 return color_by_state[button.state()]; |
88 } | 88 } |
89 | 89 |
90 #endif // OS_MACOSX | 90 #endif // OS_MACOSX |
(...skipping 19 matching lines...) Expand all Loading... |
110 | 110 |
111 #if !defined(DESKTOP_LINUX) | 111 #if !defined(DESKTOP_LINUX) |
112 // static | 112 // static |
113 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder( | 113 std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder( |
114 LabelButton* button) { | 114 LabelButton* button) { |
115 return button->CreateDefaultBorder(); | 115 return button->CreateDefaultBorder(); |
116 } | 116 } |
117 #endif | 117 #endif |
118 | 118 |
119 } // namespace views | 119 } // namespace views |
OLD | NEW |