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

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

Issue 2960393002: Hardcode ripple color/opacity for Harmony. (Closed)
Patch Set: Consolidate FloodFill as well Created 3 years, 5 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/controls/button/md_text_button.h ('k') | ui/views/controls/combobox/combobox.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/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 "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/color_palette.h" 11 #include "ui/gfx/color_palette.h"
12 #include "ui/gfx/color_utils.h" 12 #include "ui/gfx/color_utils.h"
13 #include "ui/native_theme/native_theme.h" 13 #include "ui/native_theme/native_theme.h"
14 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
15 #include "ui/views/animation/ink_drop_highlight.h" 14 #include "ui/views/animation/ink_drop_highlight.h"
16 #include "ui/views/animation/ink_drop_impl.h" 15 #include "ui/views/animation/ink_drop_impl.h"
17 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" 16 #include "ui/views/animation/ink_drop_painted_layer_delegates.h"
17 #include "ui/views/animation/ink_drop_ripple.h"
18 #include "ui/views/background.h" 18 #include "ui/views/background.h"
19 #include "ui/views/border.h" 19 #include "ui/views/border.h"
20 #include "ui/views/controls/button/blue_button.h" 20 #include "ui/views/controls/button/blue_button.h"
21 #include "ui/views/controls/focus_ring.h" 21 #include "ui/views/controls/focus_ring.h"
22 #include "ui/views/layout/layout_provider.h" 22 #include "ui/views/layout/layout_provider.h"
23 #include "ui/views/painter.h" 23 #include "ui/views/painter.h"
24 #include "ui/views/style/platform_style.h" 24 #include "ui/views/style/platform_style.h"
25 #include "ui/views/style/typography.h" 25 #include "ui/views/style/typography.h"
26 26
27 namespace views { 27 namespace views {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 SkColor MdTextButton::GetInkDropBaseColor() const { 121 SkColor MdTextButton::GetInkDropBaseColor() const {
122 return color_utils::DeriveDefaultIconColor(label()->enabled_color()); 122 return color_utils::DeriveDefaultIconColor(label()->enabled_color());
123 } 123 }
124 124
125 std::unique_ptr<InkDrop> MdTextButton::CreateInkDrop() { 125 std::unique_ptr<InkDrop> MdTextButton::CreateInkDrop() {
126 return CreateDefaultFloodFillInkDropImpl(); 126 return CreateDefaultFloodFillInkDropImpl();
127 } 127 }
128 128
129 std::unique_ptr<views::InkDropRipple> MdTextButton::CreateInkDropRipple() 129 std::unique_ptr<InkDropRipple> MdTextButton::CreateInkDropRipple() const {
130 const { 130 return CreateFloodFillInkDropRipple();
131 return std::unique_ptr<views::InkDropRipple>(
132 new views::FloodFillInkDropRipple(
133 size(), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(),
134 ink_drop_visible_opacity()));
135 } 131 }
136 132
137 void MdTextButton::StateChanged(ButtonState old_state) { 133 void MdTextButton::StateChanged(ButtonState old_state) {
138 LabelButton::StateChanged(old_state); 134 LabelButton::StateChanged(old_state);
139 UpdateColors(); 135 UpdateColors();
140 } 136 }
141 137
142 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight() 138 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight()
143 const { 139 const {
144 // The prominent button hover effect is a shadow. 140 // The prominent button hover effect is a shadow.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 286 }
291 287
292 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); 288 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
293 SetBackground( 289 SetBackground(
294 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter( 290 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter(
295 bg_color, stroke_color, kInkDropSmallCornerRadius))); 291 bg_color, stroke_color, kInkDropSmallCornerRadius)));
296 SchedulePaint(); 292 SchedulePaint();
297 } 293 }
298 294
299 } // namespace views 295 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/md_text_button.h ('k') | ui/views/controls/combobox/combobox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698