| 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_node_data.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" |
| 11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/paint_vector_icon.h" | 12 #include "ui/gfx/paint_vector_icon.h" |
| 13 #include "ui/gfx/vector_icons_public.h" | 13 #include "ui/gfx/vector_icons_public.h" |
| 14 #include "ui/resources/grit/ui_resources.h" | 14 #include "ui/resources/grit/ui_resources.h" |
| 15 #include "ui/views/resources/grit/views_resources.h" | 15 #include "ui/views/resources/grit/views_resources.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 RadioButton::~RadioButton() { | 67 RadioButton::~RadioButton() { |
| 68 } | 68 } |
| 69 | 69 |
| 70 const char* RadioButton::GetClassName() const { | 70 const char* RadioButton::GetClassName() const { |
| 71 return kViewClassName; | 71 return kViewClassName; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void RadioButton::GetAccessibleState(ui::AXViewState* state) { | 74 void RadioButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 75 Checkbox::GetAccessibleState(state); | 75 Checkbox::GetAccessibleNodeData(node_data); |
| 76 state->role = ui::AX_ROLE_RADIO_BUTTON; | 76 node_data->role = ui::AX_ROLE_RADIO_BUTTON; |
| 77 } | 77 } |
| 78 | 78 |
| 79 View* RadioButton::GetSelectedViewForGroup(int group) { | 79 View* RadioButton::GetSelectedViewForGroup(int group) { |
| 80 Views views; | 80 Views views; |
| 81 GetWidget()->GetRootView()->GetViewsInGroup(group, &views); | 81 GetWidget()->GetRootView()->GetViewsInGroup(group, &views); |
| 82 if (views.empty()) | 82 if (views.empty()) |
| 83 return NULL; | 83 return NULL; |
| 84 | 84 |
| 85 for (Views::const_iterator i(views.begin()); i != views.end(); ++i) { | 85 for (Views::const_iterator i(views.begin()); i != views.end(); ++i) { |
| 86 // REVIEW: why don't we check the runtime type like is done above? | 86 // REVIEW: why don't we check the runtime type like is done above? |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 canvas->DrawCircle(gfx::RectF(image()->bounds()).CenterPoint(), | 151 canvas->DrawCircle(gfx::RectF(image()->bounds()).CenterPoint(), |
| 152 image()->width() / 2, paint); | 152 image()->width() / 2, paint); |
| 153 } | 153 } |
| 154 | 154 |
| 155 gfx::VectorIconId RadioButton::GetVectorIconId() const { | 155 gfx::VectorIconId RadioButton::GetVectorIconId() const { |
| 156 return checked() ? gfx::VectorIconId::RADIO_BUTTON_ACTIVE | 156 return checked() ? gfx::VectorIconId::RADIO_BUTTON_ACTIVE |
| 157 : gfx::VectorIconId::RADIO_BUTTON_NORMAL; | 157 : gfx::VectorIconId::RADIO_BUTTON_NORMAL; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace views | 160 } // namespace views |
| OLD | NEW |