| 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/radio_button.h" | 5 #include "ui/views/controls/button/radio_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 bool RadioButton::IsGroupFocusTraversable() const { | 119 bool RadioButton::IsGroupFocusTraversable() const { |
| 120 // When focusing a radio button with tab/shift+tab, only the selected button | 120 // When focusing a radio button with tab/shift+tab, only the selected button |
| 121 // from the group should be focused. | 121 // from the group should be focused. |
| 122 return false; | 122 return false; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void RadioButton::OnFocus() { | 125 void RadioButton::OnFocus() { |
| 126 Checkbox::OnFocus(); | 126 Checkbox::OnFocus(); |
| 127 SetChecked(true); | 127 SetChecked(true); |
| 128 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 128 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(), |
| 129 ui::EventTimeForNow(), 0, 0); | 129 ui::EventTimeForNow(), 0, 0); |
| 130 LabelButton::NotifyClick(event); | 130 LabelButton::NotifyClick(event); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void RadioButton::NotifyClick(const ui::Event& event) { | 133 void RadioButton::NotifyClick(const ui::Event& event) { |
| 134 // Set the checked state to true only if we are unchecked, since we can't | 134 // Set the checked state to true only if we are unchecked, since we can't |
| 135 // be toggled on and off like a checkbox. | 135 // be toggled on and off like a checkbox. |
| 136 if (!checked()) | 136 if (!checked()) |
| 137 SetChecked(true); | 137 SetChecked(true); |
| 138 RequestFocus(); | 138 RequestFocus(); |
| 139 LabelButton::NotifyClick(event); | 139 LabelButton::NotifyClick(event); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ui::NativeTheme::Part RadioButton::GetThemePart() const { | 142 ui::NativeTheme::Part RadioButton::GetThemePart() const { |
| 143 return ui::NativeTheme::kRadio; | 143 return ui::NativeTheme::kRadio; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace views | 146 } // namespace views |
| OLD | NEW |