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 "grit/ui_resources.h" | 7 #include "grit/ui_resources.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/views/controls/button/label_button_border.h" | 10 #include "ui/views/controls/button/label_button_border.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 width() - rect.right()))); | 90 width() - rect.right()))); |
91 } | 91 } |
92 | 92 |
93 const char* Checkbox::GetClassName() const { | 93 const char* Checkbox::GetClassName() const { |
94 return kViewClassName; | 94 return kViewClassName; |
95 } | 95 } |
96 | 96 |
97 void Checkbox::GetAccessibleState(ui::AXViewState* state) { | 97 void Checkbox::GetAccessibleState(ui::AXViewState* state) { |
98 LabelButton::GetAccessibleState(state); | 98 LabelButton::GetAccessibleState(state); |
99 state->role = ui::AX_ROLE_CHECK_BOX; | 99 state->role = ui::AX_ROLE_CHECK_BOX; |
100 state->state = checked() ? ui::AX_STATE_CHECKED : 0; | 100 if (checked()) |
| 101 state->SetStateFlag(ui::AX_STATE_CHECKED); |
101 } | 102 } |
102 | 103 |
103 void Checkbox::OnFocus() { | 104 void Checkbox::OnFocus() { |
104 LabelButton::OnFocus(); | 105 LabelButton::OnFocus(); |
105 UpdateImage(); | 106 UpdateImage(); |
106 } | 107 } |
107 | 108 |
108 void Checkbox::OnBlur() { | 109 void Checkbox::OnBlur() { |
109 LabelButton::OnBlur(); | 110 LabelButton::OnBlur(); |
110 UpdateImage(); | 111 UpdateImage(); |
(...skipping 26 matching lines...) Expand all Loading... |
137 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 138 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
138 return ui::NativeTheme::kCheckbox; | 139 return ui::NativeTheme::kCheckbox; |
139 } | 140 } |
140 | 141 |
141 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 142 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
142 LabelButton::GetExtraParams(params); | 143 LabelButton::GetExtraParams(params); |
143 params->button.checked = checked_; | 144 params->button.checked = checked_; |
144 } | 145 } |
145 | 146 |
146 } // namespace views | 147 } // namespace views |
OLD | NEW |