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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (!is_default()) | 166 if (!is_default()) |
167 SetCallToAction(NO_CALL_TO_ACTION); | 167 SetCallToAction(NO_CALL_TO_ACTION); |
168 else if (cta_ == NO_CALL_TO_ACTION) | 168 else if (cta_ == NO_CALL_TO_ACTION) |
169 SetCallToAction(WEAK_CALL_TO_ACTION); | 169 SetCallToAction(WEAK_CALL_TO_ACTION); |
170 } | 170 } |
171 | 171 |
172 MdTextButton::MdTextButton(ButtonListener* listener) | 172 MdTextButton::MdTextButton(ButtonListener* listener) |
173 : LabelButton(listener, base::string16()), | 173 : LabelButton(listener, base::string16()), |
174 focus_ring_(new MdFocusRing()), | 174 focus_ring_(new MdFocusRing()), |
175 cta_(NO_CALL_TO_ACTION) { | 175 cta_(NO_CALL_TO_ACTION) { |
176 set_ink_drop_delegate( | 176 SetHasInkDrop(true); |
177 base::WrapUnique(new ButtonInkDropDelegate(this, this))); | |
178 set_has_ink_drop_action_on_click(true); | 177 set_has_ink_drop_action_on_click(true); |
179 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 178 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
180 SetFocusForPlatform(); | 179 SetFocusForPlatform(); |
181 SetMinSize(gfx::Size(kMinWidth, 0)); | 180 SetMinSize(gfx::Size(kMinWidth, 0)); |
182 SetFocusPainter(nullptr); | 181 SetFocusPainter(nullptr); |
183 label()->SetAutoColorReadabilityEnabled(false); | 182 label()->SetAutoColorReadabilityEnabled(false); |
184 | 183 |
185 AddChildView(focus_ring_); | 184 AddChildView(focus_ring_); |
186 focus_ring_->SetVisible(false); | 185 focus_ring_->SetVisible(false); |
187 set_request_focus_on_press(false); | 186 set_request_focus_on_press(false); |
(...skipping 26 matching lines...) Expand all Loading... |
214 cta_ == STRONG_CALL_TO_ACTION | 213 cta_ == STRONG_CALL_TO_ACTION |
215 ? Background::CreateBackgroundPainter( | 214 ? Background::CreateBackgroundPainter( |
216 true, Painter::CreateSolidRoundRectPainter( | 215 true, Painter::CreateSolidRoundRectPainter( |
217 theme->GetSystemColor( | 216 theme->GetSystemColor( |
218 ui::NativeTheme::kColorId_CallToActionColor), | 217 ui::NativeTheme::kColorId_CallToActionColor), |
219 kInkDropSmallCornerRadius)) | 218 kInkDropSmallCornerRadius)) |
220 : nullptr); | 219 : nullptr); |
221 } | 220 } |
222 | 221 |
223 } // namespace views | 222 } // namespace views |
OLD | NEW |