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/menu/menu_item_view.h" | 5 #include "ui/views/controls/menu/menu_item_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 } else { | 167 } else { |
168 item_text = title_; | 168 item_text = title_; |
169 } | 169 } |
170 node_data->SetName(GetAccessibleNameForMenuItem(item_text, GetMinorText())); | 170 node_data->SetName(GetAccessibleNameForMenuItem(item_text, GetMinorText())); |
171 | 171 |
172 switch (GetType()) { | 172 switch (GetType()) { |
173 case SUBMENU: | 173 case SUBMENU: |
174 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP); | 174 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP); |
175 break; | 175 break; |
176 case CHECKBOX: | 176 case CHECKBOX: |
177 case RADIO: | 177 case RADIO: { |
178 if (GetDelegate()->IsItemChecked(GetCommand())) | 178 const bool isChecked = GetDelegate()->IsItemChecked(GetCommand()); |
dmazzoni
2017/03/09 19:33:41
is_checked
| |
179 node_data->AddStateFlag(ui::AX_STATE_CHECKED); | 179 const int checkedState = |
dmazzoni
2017/03/09 19:33:41
checked_state
Also type AXCheckedState
aleventhal
2017/03/09 21:40:49
Done.
| |
180 break; | 180 isChecked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE; |
181 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checkedState); | |
182 } break; | |
181 case NORMAL: | 183 case NORMAL: |
182 case SEPARATOR: | 184 case SEPARATOR: |
183 case EMPTY: | 185 case EMPTY: |
184 // No additional accessibility states currently for these menu states. | 186 // No additional accessibility states currently for these menu states. |
185 break; | 187 break; |
186 } | 188 } |
187 } | 189 } |
188 | 190 |
189 // static | 191 // static |
190 bool MenuItemView::IsBubble(MenuAnchorPosition anchor) { | 192 bool MenuItemView::IsBubble(MenuAnchorPosition anchor) { |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 } else { | 1068 } else { |
1067 const Type& type = menu_item->GetType(); | 1069 const Type& type = menu_item->GetType(); |
1068 if (type == CHECKBOX || type == RADIO) | 1070 if (type == CHECKBOX || type == RADIO) |
1069 return true; | 1071 return true; |
1070 } | 1072 } |
1071 } | 1073 } |
1072 return false; | 1074 return false; |
1073 } | 1075 } |
1074 | 1076 |
1075 } // namespace views | 1077 } // namespace views |
OLD | NEW |