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

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

Issue 2259753003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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.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 "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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 // static 47 // static
48 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 48 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
49 return base::WrapUnique(new FocusableRoundedBorder); 49 return base::WrapUnique(new FocusableRoundedBorder);
50 } 50 }
51 51
52 // static 52 // static
53 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground( 53 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
54 int shoulder_width) { 54 int shoulder_width) {
55 return base::WrapUnique(new ComboboxBackgroundMac(shoulder_width)); 55 return base::MakeUnique<ComboboxBackgroundMac>(shoulder_width);
56 } 56 }
57 57
58 // static 58 // static
59 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 59 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
60 Button::ButtonStyle style) { 60 Button::ButtonStyle style) {
61 if (style == Button::STYLE_BUTTON) 61 if (style == Button::STYLE_BUTTON)
62 return base::WrapUnique(new DialogButtonBorderMac()); 62 return base::MakeUnique<DialogButtonBorderMac>();
63 63
64 return base::WrapUnique(new LabelButtonAssetBorder(style)); 64 return base::MakeUnique<LabelButtonAssetBorder>(style);
65 } 65 }
66 66
67 // static 67 // static
68 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 68 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
69 return base::WrapUnique(new CocoaScrollBar(is_horizontal)); 69 return base::MakeUnique<CocoaScrollBar>(is_horizontal);
70 } 70 }
71 71
72 // static 72 // static
73 SkColor PlatformStyle::TextColorForButton( 73 SkColor PlatformStyle::TextColorForButton(
74 const ButtonColorByState& color_by_state, 74 const ButtonColorByState& color_by_state,
75 const LabelButton& button) { 75 const LabelButton& button) {
76 Button::ButtonState state = button.state(); 76 Button::ButtonState state = button.state();
77 if (button.style() == Button::STYLE_BUTTON && 77 if (button.style() == Button::STYLE_BUTTON &&
78 DialogButtonBorderMac::ShouldRenderDefault(button)) { 78 DialogButtonBorderMac::ShouldRenderDefault(button)) {
79 // For convenience, we currently assume Mac wants the color corresponding to 79 // For convenience, we currently assume Mac wants the color corresponding to
80 // the pressed state for default buttons. 80 // the pressed state for default buttons.
81 state = Button::STATE_PRESSED; 81 state = Button::STATE_PRESSED;
82 } 82 }
83 return color_by_state[state]; 83 return color_by_state[state];
84 } 84 }
85 85
86 // static 86 // static
87 void PlatformStyle::ApplyLabelButtonTextStyle( 87 void PlatformStyle::ApplyLabelButtonTextStyle(
88 views::Label* label, 88 views::Label* label,
89 ButtonColorByState* color_by_state) { 89 ButtonColorByState* color_by_state) {
90 const ui::NativeTheme* theme = label->GetNativeTheme(); 90 const ui::NativeTheme* theme = label->GetNativeTheme();
91 ButtonColorByState& colors = *color_by_state; 91 ButtonColorByState& colors = *color_by_state;
92 colors[Button::STATE_PRESSED] = 92 colors[Button::STATE_PRESSED] =
93 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); 93 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor);
94 } 94 }
95 95
96 } // namespace views 96 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/style/platform_style.cc ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698