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 "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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 | 208 |
209 void MdTextButton::UpdateStyleToIndicateDefaultStatus() { | 209 void MdTextButton::UpdateStyleToIndicateDefaultStatus() { |
210 UpdateColors(); | 210 UpdateColors(); |
211 } | 211 } |
212 | 212 |
213 MdTextButton::MdTextButton(ButtonListener* listener) | 213 MdTextButton::MdTextButton(ButtonListener* listener) |
214 : LabelButton(listener, base::string16()), | 214 : LabelButton(listener, base::string16()), |
215 focus_ring_(new internal::MdFocusRing()), | 215 focus_ring_(new internal::MdFocusRing()), |
216 is_cta_(false) { | 216 is_cta_(false) { |
217 SetHasInkDrop(true); | 217 SetInkDropMode(InkDropMode::ON); |
218 set_has_ink_drop_action_on_click(true); | 218 set_has_ink_drop_action_on_click(true); |
219 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 219 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
220 SetFocusForPlatform(); | 220 SetFocusForPlatform(); |
221 SetMinSize(gfx::Size(kMinWidth, 0)); | 221 SetMinSize(gfx::Size(kMinWidth, 0)); |
222 SetFocusPainter(nullptr); | 222 SetFocusPainter(nullptr); |
223 label()->SetAutoColorReadabilityEnabled(false); | 223 label()->SetAutoColorReadabilityEnabled(false); |
224 SetFontList(GetMdFontList()); | 224 SetFontList(GetMdFontList()); |
225 | 225 |
226 AddChildView(focus_ring_); | 226 AddChildView(focus_ring_); |
227 focus_ring_->SetVisible(false); | 227 focus_ring_->SetVisible(false); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color)) | 273 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color)) |
274 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity) | 274 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity) |
275 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity); | 275 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity); |
276 | 276 |
277 set_background(Background::CreateBackgroundPainter( | 277 set_background(Background::CreateBackgroundPainter( |
278 true, Painter::CreateRoundRectWith1PxBorderPainter( | 278 true, Painter::CreateRoundRectWith1PxBorderPainter( |
279 bg_color, stroke_color, kInkDropSmallCornerRadius))); | 279 bg_color, stroke_color, kInkDropSmallCornerRadius))); |
280 } | 280 } |
281 | 281 |
282 } // namespace views | 282 } // namespace views |
OLD | NEW |