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

Side by Side Diff: ui/views/controls/button/md_text_button.cc

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
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/controls/button/md_text_button.h" 5 #include "ui/views/controls/button/md_text_button.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 const int kYOffset = 1; 192 const int kYOffset = 1;
193 const int kSkiaBlurRadius = 1; 193 const int kSkiaBlurRadius = 1;
194 std::vector<gfx::ShadowValue> shadows; 194 std::vector<gfx::ShadowValue> shadows;
195 // The notion of blur that gfx::ShadowValue uses is twice the Skia/CSS value. 195 // The notion of blur that gfx::ShadowValue uses is twice the Skia/CSS value.
196 // Skia counts the number of pixels outside the mask area whereas 196 // Skia counts the number of pixels outside the mask area whereas
197 // gfx::ShadowValue counts together the number of pixels inside and outside 197 // gfx::ShadowValue counts together the number of pixels inside and outside
198 // the mask bounds. 198 // the mask bounds.
199 shadows.push_back(gfx::ShadowValue(gfx::Vector2d(0, kYOffset), 199 shadows.push_back(gfx::ShadowValue(gfx::Vector2d(0, kYOffset),
200 2 * kSkiaBlurRadius, 200 2 * kSkiaBlurRadius,
201 SkColorSetA(SK_ColorBLACK, 0x3D))); 201 SkColorSetA(SK_ColorBLACK, 0x3D)));
202 return base::WrapUnique(new InkDropHighlight( 202 return base::MakeUnique<InkDropHighlight>(
203 gfx::RectF(GetLocalBounds()).CenterPoint(), 203 gfx::RectF(GetLocalBounds()).CenterPoint(),
204 base::WrapUnique(new BorderShadowLayerDelegate( 204 base::WrapUnique(new BorderShadowLayerDelegate(
205 shadows, GetLocalBounds(), kInkDropSmallCornerRadius)))); 205 shadows, GetLocalBounds(), kInkDropSmallCornerRadius)));
206 } 206 }
207 207
208 bool MdTextButton::ShouldShowInkDropForFocus() const { 208 bool MdTextButton::ShouldShowInkDropForFocus() const {
209 // These types of button use |focus_ring_|. 209 // These types of button use |focus_ring_|.
210 return false; 210 return false;
211 } 211 }
212 212
213 void MdTextButton::SetEnabledTextColors(SkColor color) { 213 void MdTextButton::SetEnabledTextColors(SkColor color) {
214 LabelButton::SetEnabledTextColors(color); 214 LabelButton::SetEnabledTextColors(color);
215 UpdateColors(); 215 UpdateColors();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color)) 304 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color))
305 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity) 305 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity)
306 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity); 306 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity);
307 307
308 set_background(Background::CreateBackgroundPainter( 308 set_background(Background::CreateBackgroundPainter(
309 true, Painter::CreateRoundRectWith1PxBorderPainter( 309 true, Painter::CreateRoundRectWith1PxBorderPainter(
310 bg_color, stroke_color, kInkDropSmallCornerRadius))); 310 bg_color, stroke_color, kInkDropSmallCornerRadius)));
311 } 311 }
312 312
313 } // namespace views 313 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/menu/menu_scroll_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698