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

Side by Side Diff: ui/views/style/platform_style_mac.mm

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/views/style/platform_style_linux.cc ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/paint_vector_icon.h" 9 #include "ui/gfx/paint_vector_icon.h"
9 #include "ui/gfx/vector_icons.h" 10 #include "ui/gfx/vector_icons.h"
10 #include "ui/resources/grit/ui_resources.h" 11 #include "ui/resources/grit/ui_resources.h"
11 #include "ui/views/controls/button/label_button.h" 12 #include "ui/views/controls/button/label_button.h"
12 #include "ui/views/controls/button/label_button_border.h" 13 #include "ui/views/controls/button/label_button_border.h"
13 #include "ui/views/controls/focusable_rounded_border_mac.h" 14 #include "ui/views/controls/focusable_rounded_border_mac.h"
14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" 15 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h"
15 #include "ui/views/style/mac/combobox_background_mac.h" 16 #include "ui/views/style/mac/combobox_background_mac.h"
16 #include "ui/views/style/mac/dialog_button_border_mac.h" 17 #include "ui/views/style/mac/dialog_button_border_mac.h"
(...skipping 13 matching lines...) Expand all
30 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 31 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
31 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 32 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
32 } 33 }
33 const int kComboboxArrowWidth = 13; 34 const int kComboboxArrowWidth = 13;
34 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC, 35 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC,
35 kComboboxArrowWidth, 36 kComboboxArrowWidth,
36 is_enabled ? SK_ColorWHITE : SK_ColorBLACK); 37 is_enabled ? SK_ColorWHITE : SK_ColorBLACK);
37 } 38 }
38 39
39 // static 40 // static
40 scoped_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 41 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
41 return make_scoped_ptr(new FocusableRoundedBorder); 42 return base::WrapUnique(new FocusableRoundedBorder);
42 } 43 }
43 44
44 // static 45 // static
45 scoped_ptr<Background> PlatformStyle::CreateComboboxBackground() { 46 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() {
46 return make_scoped_ptr(new ComboboxBackgroundMac); 47 return base::WrapUnique(new ComboboxBackgroundMac);
47 } 48 }
48 49
49 // static 50 // static
50 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 51 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
51 Button::ButtonStyle style) { 52 Button::ButtonStyle style) {
52 if (style == Button::STYLE_BUTTON) 53 if (style == Button::STYLE_BUTTON)
53 return make_scoped_ptr(new DialogButtonBorderMac()); 54 return base::WrapUnique(new DialogButtonBorderMac());
54 55
55 return make_scoped_ptr(new LabelButtonAssetBorder(style)); 56 return base::WrapUnique(new LabelButtonAssetBorder(style));
56 } 57 }
57 58
58 // static 59 // static
59 scoped_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 60 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
60 return make_scoped_ptr(new CocoaScrollBar(is_horizontal)); 61 return base::WrapUnique(new CocoaScrollBar(is_horizontal));
61 } 62 }
62 63
63 // static 64 // static
64 SkColor PlatformStyle::TextColorForButton( 65 SkColor PlatformStyle::TextColorForButton(
65 const ButtonColorByState& color_by_state, 66 const ButtonColorByState& color_by_state,
66 const LabelButton& button) { 67 const LabelButton& button) {
67 Button::ButtonState state = button.state(); 68 Button::ButtonState state = button.state();
68 if (button.style() == Button::STYLE_BUTTON && 69 if (button.style() == Button::STYLE_BUTTON &&
69 DialogButtonBorderMac::ShouldRenderDefault(button)) { 70 DialogButtonBorderMac::ShouldRenderDefault(button)) {
70 // For convenience, we currently assume Mac wants the color corresponding to 71 // For convenience, we currently assume Mac wants the color corresponding to
71 // the pressed state for default buttons. 72 // the pressed state for default buttons.
72 state = Button::STATE_PRESSED; 73 state = Button::STATE_PRESSED;
73 } 74 }
74 return color_by_state[state]; 75 return color_by_state[state];
75 } 76 }
76 77
77 // static 78 // static
78 void PlatformStyle::ApplyLabelButtonTextStyle( 79 void PlatformStyle::ApplyLabelButtonTextStyle(
79 views::Label* label, 80 views::Label* label,
80 ButtonColorByState* color_by_state) { 81 ButtonColorByState* color_by_state) {
81 const ui::NativeTheme* theme = label->GetNativeTheme(); 82 const ui::NativeTheme* theme = label->GetNativeTheme();
82 ButtonColorByState& colors = *color_by_state; 83 ButtonColorByState& colors = *color_by_state;
83 colors[Button::STATE_PRESSED] = 84 colors[Button::STATE_PRESSED] =
84 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); 85 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor);
85 } 86 }
86 87
87 } // namespace views 88 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/style/platform_style_linux.cc ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698