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