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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 void MdTextButton::UpdateStyleToIndicateDefaultStatus() { | 162 void MdTextButton::UpdateStyleToIndicateDefaultStatus() { |
163 UpdateColorsFromNativeTheme(); | 163 UpdateColorsFromNativeTheme(); |
164 } | 164 } |
165 | 165 |
166 MdTextButton::MdTextButton(ButtonListener* listener) | 166 MdTextButton::MdTextButton(ButtonListener* listener) |
167 : LabelButton(listener, base::string16()), | 167 : LabelButton(listener, base::string16()), |
168 focus_ring_(new MdFocusRing()), | 168 focus_ring_(new MdFocusRing()), |
169 cta_(false) { | 169 cta_(false) { |
170 SetHasInkDrop(true); | 170 SetHasInkDrop(INK_DROP_WITH_GESTURE_HANDLING); |
171 set_has_ink_drop_action_on_click(true); | 171 set_has_ink_drop_action_on_click(true); |
172 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 172 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
173 SetFocusForPlatform(); | 173 SetFocusForPlatform(); |
174 SetMinSize(gfx::Size(kMinWidth, 0)); | 174 SetMinSize(gfx::Size(kMinWidth, 0)); |
175 SetFocusPainter(nullptr); | 175 SetFocusPainter(nullptr); |
176 label()->SetAutoColorReadabilityEnabled(false); | 176 label()->SetAutoColorReadabilityEnabled(false); |
177 SetFontList(GetMdFontList()); | 177 SetFontList(GetMdFontList()); |
178 | 178 |
179 AddChildView(focus_ring_); | 179 AddChildView(focus_ring_); |
180 focus_ring_->SetVisible(false); | 180 focus_ring_->SetVisible(false); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 : is_default() | 220 : is_default() |
221 ? color_utils::BlendTowardOppositeLuma(text_color, 0xD8) | 221 ? color_utils::BlendTowardOppositeLuma(text_color, 0xD8) |
222 : SK_ColorTRANSPARENT; | 222 : SK_ColorTRANSPARENT; |
223 SkColor stroke_color = SkColorSetA(SK_ColorBLACK, 0x1A); | 223 SkColor stroke_color = SkColorSetA(SK_ColorBLACK, 0x1A); |
224 set_background(Background::CreateBackgroundPainter( | 224 set_background(Background::CreateBackgroundPainter( |
225 true, Painter::CreateRoundRectWith1PxBorderPainter( | 225 true, Painter::CreateRoundRectWith1PxBorderPainter( |
226 bg_color, stroke_color, kInkDropSmallCornerRadius))); | 226 bg_color, stroke_color, kInkDropSmallCornerRadius))); |
227 } | 227 } |
228 | 228 |
229 } // namespace views | 229 } // namespace views |
OLD | NEW |