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/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 LabelButton::SetText(base::i18n::ToUpper(text)); | 69 LabelButton::SetText(base::i18n::ToUpper(text)); |
70 } | 70 } |
71 | 71 |
72 MdTextButton::MdTextButton(ButtonListener* listener) | 72 MdTextButton::MdTextButton(ButtonListener* listener) |
73 : LabelButton(listener, base::string16()), | 73 : LabelButton(listener, base::string16()), |
74 ink_drop_delegate_(this, this), | 74 ink_drop_delegate_(this, this), |
75 cta_(NO_CALL_TO_ACTION) { | 75 cta_(NO_CALL_TO_ACTION) { |
76 set_ink_drop_delegate(&ink_drop_delegate_); | 76 set_ink_drop_delegate(&ink_drop_delegate_); |
77 set_has_ink_drop_action_on_click(true); | 77 set_has_ink_drop_action_on_click(true); |
78 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 78 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
79 SetFocusBehavior(FocusBehavior::ALWAYS); | 79 Button::ConfigureDefaultFocus(this); |
80 SetMinSize(gfx::Size(kMinWidth, 0)); | 80 SetMinSize(gfx::Size(kMinWidth, 0)); |
81 SetFocusPainter(nullptr); | 81 SetFocusPainter(nullptr); |
82 UseMdFocusRing(); | 82 UseMdFocusRing(); |
83 label()->SetAutoColorReadabilityEnabled(false); | 83 label()->SetAutoColorReadabilityEnabled(false); |
84 } | 84 } |
85 | 85 |
86 MdTextButton::~MdTextButton() {} | 86 MdTextButton::~MdTextButton() {} |
87 | 87 |
88 void MdTextButton::UpdateColorsFromNativeTheme() { | 88 void MdTextButton::UpdateColorsFromNativeTheme() { |
89 ui::NativeTheme::ColorId fg_color_id = ui::NativeTheme::kColorId_NumColors; | 89 ui::NativeTheme::ColorId fg_color_id = ui::NativeTheme::kColorId_NumColors; |
(...skipping 15 matching lines...) Expand all Loading... |
105 cta_ == STRONG_CALL_TO_ACTION | 105 cta_ == STRONG_CALL_TO_ACTION |
106 ? Background::CreateBackgroundPainter( | 106 ? Background::CreateBackgroundPainter( |
107 true, Painter::CreateSolidRoundRectPainter( | 107 true, Painter::CreateSolidRoundRectPainter( |
108 theme->GetSystemColor( | 108 theme->GetSystemColor( |
109 ui::NativeTheme::kColorId_CallToActionColor), | 109 ui::NativeTheme::kColorId_CallToActionColor), |
110 kInkDropSmallCornerRadius)) | 110 kInkDropSmallCornerRadius)) |
111 : nullptr); | 111 : nullptr); |
112 } | 112 } |
113 | 113 |
114 } // namespace views | 114 } // namespace views |
OLD | NEW |