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/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" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 std::unique_ptr<views::InkDropRipple> MdTextButton::CreateInkDropRipple() | 130 std::unique_ptr<views::InkDropRipple> MdTextButton::CreateInkDropRipple() |
131 const { | 131 const { |
132 return std::unique_ptr<views::InkDropRipple>( | 132 return std::unique_ptr<views::InkDropRipple>( |
133 new views::FloodFillInkDropRipple( | 133 new views::FloodFillInkDropRipple( |
134 size(), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), | 134 size(), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), |
135 ink_drop_visible_opacity())); | 135 ink_drop_visible_opacity())); |
136 } | 136 } |
137 | 137 |
138 void MdTextButton::StateChanged() { | 138 void MdTextButton::StateChanged(ButtonState old_state) { |
139 LabelButton::StateChanged(); | 139 LabelButton::StateChanged(old_state); |
140 UpdateColors(); | 140 UpdateColors(); |
141 } | 141 } |
142 | 142 |
143 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight() | 143 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight() |
144 const { | 144 const { |
145 // The prominent button hover effect is a shadow. | 145 // The prominent button hover effect is a shadow. |
146 const int kYOffset = 1; | 146 const int kYOffset = 1; |
147 const int kSkiaBlurRadius = 2; | 147 const int kSkiaBlurRadius = 2; |
148 const int shadow_alpha = is_prominent_ ? 0x3D : 0x1A; | 148 const int shadow_alpha = is_prominent_ ? 0x3D : 0x1A; |
149 std::vector<gfx::ShadowValue> shadows; | 149 std::vector<gfx::ShadowValue> shadows; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 stroke_color, gfx::kDisabledControlAlpha); | 297 stroke_color, gfx::kDisabledControlAlpha); |
298 } | 298 } |
299 | 299 |
300 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); | 300 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); |
301 set_background(Background::CreateBackgroundPainter( | 301 set_background(Background::CreateBackgroundPainter( |
302 Painter::CreateRoundRectWith1PxBorderPainter(bg_color, stroke_color, | 302 Painter::CreateRoundRectWith1PxBorderPainter(bg_color, stroke_color, |
303 kInkDropSmallCornerRadius))); | 303 kInkDropSmallCornerRadius))); |
304 } | 304 } |
305 | 305 |
306 } // namespace views | 306 } // namespace views |
OLD | NEW |