| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 void MdTextButton::SetFontList(const gfx::FontList& font_list) { | 183 void MdTextButton::SetFontList(const gfx::FontList& font_list) { |
| 184 NOTREACHED() | 184 NOTREACHED() |
| 185 << "Don't call MdTextButton::SetFontList (it will soon be protected)"; | 185 << "Don't call MdTextButton::SetFontList (it will soon be protected)"; |
| 186 } | 186 } |
| 187 | 187 |
| 188 MdTextButton::MdTextButton(ButtonListener* listener) | 188 MdTextButton::MdTextButton(ButtonListener* listener) |
| 189 : LabelButton(listener, base::string16()), | 189 : LabelButton(listener, base::string16()), |
| 190 is_prominent_(false) { | 190 is_prominent_(false) { |
| 191 SetInkDropMode(PlatformStyle::kUseRipples ? InkDropMode::ON | 191 SetInkDropMode(InkDropMode::ON); |
| 192 : InkDropMode::OFF); | |
| 193 set_has_ink_drop_action_on_click(true); | 192 set_has_ink_drop_action_on_click(true); |
| 194 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 193 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 195 SetFocusForPlatform(); | 194 SetFocusForPlatform(); |
| 196 const int minimum_width = LayoutProvider::Get()->GetDistanceMetric( | 195 const int minimum_width = LayoutProvider::Get()->GetDistanceMetric( |
| 197 DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH); | 196 DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH); |
| 198 SetMinSize(gfx::Size(minimum_width, 0)); | 197 SetMinSize(gfx::Size(minimum_width, 0)); |
| 199 SetFocusPainter(nullptr); | 198 SetFocusPainter(nullptr); |
| 200 label()->SetAutoColorReadabilityEnabled(false); | 199 label()->SetAutoColorReadabilityEnabled(false); |
| 201 set_request_focus_on_press(false); | 200 set_request_focus_on_press(false); |
| 202 LabelButton::SetFontList(GetMdFontList()); | 201 LabelButton::SetFontList(GetMdFontList()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 stroke_color, gfx::kDisabledControlAlpha); | 297 stroke_color, gfx::kDisabledControlAlpha); |
| 299 } | 298 } |
| 300 | 299 |
| 301 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); | 300 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); |
| 302 set_background(Background::CreateBackgroundPainter( | 301 set_background(Background::CreateBackgroundPainter( |
| 303 Painter::CreateRoundRectWith1PxBorderPainter(bg_color, stroke_color, | 302 Painter::CreateRoundRectWith1PxBorderPainter(bg_color, stroke_color, |
| 304 kInkDropSmallCornerRadius))); | 303 kInkDropSmallCornerRadius))); |
| 305 } | 304 } |
| 306 | 305 |
| 307 } // namespace views | 306 } // namespace views |
| OLD | NEW |