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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 const char* Checkbox::GetClassName() const { | 119 const char* Checkbox::GetClassName() const { |
120 return kViewClassName; | 120 return kViewClassName; |
121 } | 121 } |
122 | 122 |
123 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 123 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
124 LabelButton::GetAccessibleNodeData(node_data); | 124 LabelButton::GetAccessibleNodeData(node_data); |
125 node_data->role = ui::AX_ROLE_CHECK_BOX; | 125 node_data->role = ui::AX_ROLE_CHECK_BOX; |
126 if (checked()) | 126 if (checked()) { |
127 node_data->AddStateFlag(ui::AX_STATE_CHECKED); | 127 node_data->AddStateFlag(ui::AX_STATE_CHECKED); |
128 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, | |
sky
2016/11/28 22:32:00
Shouldn't the check/uncheck only be added if enabl
| |
129 ui::AX_SUPPORTED_ACTION_UNCHECK); | |
130 } else { | |
131 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, | |
132 ui::AX_SUPPORTED_ACTION_CHECK); | |
133 } | |
128 } | 134 } |
129 | 135 |
130 void Checkbox::OnPaint(gfx::Canvas* canvas) { | 136 void Checkbox::OnPaint(gfx::Canvas* canvas) { |
131 LabelButton::OnPaint(canvas); | 137 LabelButton::OnPaint(canvas); |
132 | 138 |
133 if (!UseMd() || !HasFocus()) | 139 if (!UseMd() || !HasFocus()) |
134 return; | 140 return; |
135 | 141 |
136 SkPaint focus_paint; | 142 SkPaint focus_paint; |
137 focus_paint.setAntiAlias(true); | 143 focus_paint.setAntiAlias(true); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 229 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
224 return ui::NativeTheme::kCheckbox; | 230 return ui::NativeTheme::kCheckbox; |
225 } | 231 } |
226 | 232 |
227 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 233 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
228 LabelButton::GetExtraParams(params); | 234 LabelButton::GetExtraParams(params); |
229 params->button.checked = checked_; | 235 params->button.checked = checked_; |
230 } | 236 } |
231 | 237 |
232 } // namespace views | 238 } // namespace views |
OLD | NEW |