| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/checkbox.h" | 5 #include "ui/views/controls/button/checkbox.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 Checkbox::Checkbox(const base::string16& label) | 31 Checkbox::Checkbox(const base::string16& label) |
| 32 : LabelButton(NULL, label), | 32 : LabelButton(NULL, label), |
| 33 checked_(false) { | 33 checked_(false) { |
| 34 SetHorizontalAlignment(gfx::ALIGN_LEFT); | 34 SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 35 SetFocusForPlatform(); | 35 SetFocusForPlatform(); |
| 36 SetFocusPainter(nullptr); | 36 SetFocusPainter(nullptr); |
| 37 | 37 |
| 38 if (UseMd()) { | 38 if (UseMd()) { |
| 39 set_request_focus_on_press(false); | 39 set_request_focus_on_press(false); |
| 40 SetInkDropMode(PlatformStyle::kUseRipples ? InkDropMode::ON | 40 SetInkDropMode(InkDropMode::ON); |
| 41 : InkDropMode::OFF); | |
| 42 set_has_ink_drop_action_on_click(true); | 41 set_has_ink_drop_action_on_click(true); |
| 43 } else { | 42 } else { |
| 44 std::unique_ptr<LabelButtonBorder> button_border(new LabelButtonBorder()); | 43 std::unique_ptr<LabelButtonBorder> button_border(new LabelButtonBorder()); |
| 45 // Inset the trailing side by a couple pixels for the focus border. | 44 // Inset the trailing side by a couple pixels for the focus border. |
| 46 button_border->set_insets(gfx::Insets(0, 0, 0, 2)); | 45 button_border->set_insets(gfx::Insets(0, 0, 0, 2)); |
| 47 SetBorder(std::move(button_border)); | 46 SetBorder(std::move(button_border)); |
| 48 set_request_focus_on_press(true); | 47 set_request_focus_on_press(true); |
| 49 | 48 |
| 50 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 49 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 51 | 50 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 220 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
| 222 return ui::NativeTheme::kCheckbox; | 221 return ui::NativeTheme::kCheckbox; |
| 223 } | 222 } |
| 224 | 223 |
| 225 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 224 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
| 226 LabelButton::GetExtraParams(params); | 225 LabelButton::GetExtraParams(params); |
| 227 params->button.checked = checked_; | 226 params->button.checked = checked_; |
| 228 } | 227 } |
| 229 | 228 |
| 230 } // namespace views | 229 } // namespace views |
| OLD | NEW |