Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: ui/accessibility/ax_text_utils.cc

Issue 2863703003: A11y: Rename AXSupportedAction to AXDefaultActionVerb. (Closed)
Patch Set: Rebase. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/accessibility/ax_text_utils.h ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/accessibility/ax_text_utils.h" 5 #include "ui/accessibility/ax_text_utils.h"
6 6
7 #include "base/i18n/break_iterator.h" 7 #include "base/i18n/break_iterator.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 if (direction == FORWARDS_DIRECTION) { 110 if (direction == FORWARDS_DIRECTION) {
111 result++; 111 result++;
112 } else { 112 } else {
113 result--; 113 result--;
114 } 114 }
115 } 115 }
116 } 116 }
117 117
118 base::string16 ActionToString(const AXSupportedAction supported_action) { 118 base::string16 ActionVerbToLocalizedString(
119 switch (supported_action) { 119 const AXDefaultActionVerb action_verb) {
120 case AX_SUPPORTED_ACTION_NONE: 120 switch (action_verb) {
121 case AX_DEFAULT_ACTION_VERB_NONE:
121 return base::string16(); 122 return base::string16();
122 case AX_SUPPORTED_ACTION_ACTIVATE: 123 case AX_DEFAULT_ACTION_VERB_ACTIVATE:
123 return l10n_util::GetStringUTF16(IDS_AX_ACTIVATE_ACTION_VERB); 124 return l10n_util::GetStringUTF16(IDS_AX_ACTIVATE_ACTION_VERB);
124 case AX_SUPPORTED_ACTION_CHECK: 125 case AX_DEFAULT_ACTION_VERB_CHECK:
125 return l10n_util::GetStringUTF16(IDS_AX_CHECK_ACTION_VERB); 126 return l10n_util::GetStringUTF16(IDS_AX_CHECK_ACTION_VERB);
126 case AX_SUPPORTED_ACTION_CLICK: 127 case AX_DEFAULT_ACTION_VERB_CLICK:
127 return l10n_util::GetStringUTF16(IDS_AX_CLICK_ACTION_VERB); 128 return l10n_util::GetStringUTF16(IDS_AX_CLICK_ACTION_VERB);
128 case AX_SUPPORTED_ACTION_JUMP: 129 case AX_DEFAULT_ACTION_VERB_JUMP:
129 return l10n_util::GetStringUTF16(IDS_AX_JUMP_ACTION_VERB); 130 return l10n_util::GetStringUTF16(IDS_AX_JUMP_ACTION_VERB);
130 case AX_SUPPORTED_ACTION_OPEN: 131 case AX_DEFAULT_ACTION_VERB_OPEN:
131 return l10n_util::GetStringUTF16(IDS_AX_OPEN_ACTION_VERB); 132 return l10n_util::GetStringUTF16(IDS_AX_OPEN_ACTION_VERB);
132 case AX_SUPPORTED_ACTION_PRESS: 133 case AX_DEFAULT_ACTION_VERB_PRESS:
133 return l10n_util::GetStringUTF16(IDS_AX_PRESS_ACTION_VERB); 134 return l10n_util::GetStringUTF16(IDS_AX_PRESS_ACTION_VERB);
134 case AX_SUPPORTED_ACTION_SELECT: 135 case AX_DEFAULT_ACTION_VERB_SELECT:
135 return l10n_util::GetStringUTF16(IDS_AX_SELECT_ACTION_VERB); 136 return l10n_util::GetStringUTF16(IDS_AX_SELECT_ACTION_VERB);
136 case AX_SUPPORTED_ACTION_UNCHECK: 137 case AX_DEFAULT_ACTION_VERB_UNCHECK:
137 return l10n_util::GetStringUTF16(IDS_AX_UNCHECK_ACTION_VERB); 138 return l10n_util::GetStringUTF16(IDS_AX_UNCHECK_ACTION_VERB);
138 } 139 }
139 NOTREACHED(); 140 NOTREACHED();
140 return base::string16(); 141 return base::string16();
141 } 142 }
142 143
143 // Some APIs on Linux and Windows need to return non-localized action names. 144 // Some APIs on Linux and Windows need to return non-localized action names.
144 base::string16 ActionToUnlocalizedString( 145 base::string16 ActionVerbToUnlocalizedString(
145 const AXSupportedAction supported_action) { 146 const AXDefaultActionVerb action_verb) {
146 switch (supported_action) { 147 switch (action_verb) {
147 case ui::AX_SUPPORTED_ACTION_NONE: 148 case ui::AX_DEFAULT_ACTION_VERB_NONE:
148 return base::UTF8ToUTF16("none"); 149 return base::UTF8ToUTF16("none");
149 case ui::AX_SUPPORTED_ACTION_ACTIVATE: 150 case ui::AX_DEFAULT_ACTION_VERB_ACTIVATE:
150 return base::UTF8ToUTF16("activate"); 151 return base::UTF8ToUTF16("activate");
151 case ui::AX_SUPPORTED_ACTION_CHECK: 152 case ui::AX_DEFAULT_ACTION_VERB_CHECK:
152 return base::UTF8ToUTF16("check"); 153 return base::UTF8ToUTF16("check");
153 case ui::AX_SUPPORTED_ACTION_CLICK: 154 case ui::AX_DEFAULT_ACTION_VERB_CLICK:
154 return base::UTF8ToUTF16("click"); 155 return base::UTF8ToUTF16("click");
155 case ui::AX_SUPPORTED_ACTION_JUMP: 156 case ui::AX_DEFAULT_ACTION_VERB_JUMP:
156 return base::UTF8ToUTF16("jump"); 157 return base::UTF8ToUTF16("jump");
157 case ui::AX_SUPPORTED_ACTION_OPEN: 158 case ui::AX_DEFAULT_ACTION_VERB_OPEN:
158 return base::UTF8ToUTF16("open"); 159 return base::UTF8ToUTF16("open");
159 case ui::AX_SUPPORTED_ACTION_PRESS: 160 case ui::AX_DEFAULT_ACTION_VERB_PRESS:
160 return base::UTF8ToUTF16("press"); 161 return base::UTF8ToUTF16("press");
161 case ui::AX_SUPPORTED_ACTION_SELECT: 162 case ui::AX_DEFAULT_ACTION_VERB_SELECT:
162 return base::UTF8ToUTF16("select"); 163 return base::UTF8ToUTF16("select");
163 case ui::AX_SUPPORTED_ACTION_UNCHECK: 164 case ui::AX_DEFAULT_ACTION_VERB_UNCHECK:
164 return base::UTF8ToUTF16("uncheck"); 165 return base::UTF8ToUTF16("uncheck");
165 } 166 }
166 NOTREACHED(); 167 NOTREACHED();
167 return base::string16(); 168 return base::string16();
168 } 169 }
169 170
170 } // namespace ui 171 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_text_utils.h ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698