| OLD | NEW |
| 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 Loading... |
| 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 ActionToString(const AXDefaultActionVerb action_verb) { |
| 119 switch (supported_action) { | 119 switch (action_verb) { |
| 120 case AX_SUPPORTED_ACTION_NONE: | 120 case AX_DEFAULT_ACTION_VERB_NONE: |
| 121 return base::string16(); | 121 return base::string16(); |
| 122 case AX_SUPPORTED_ACTION_ACTIVATE: | 122 case AX_DEFAULT_ACTION_VERB_ACTIVATE: |
| 123 return l10n_util::GetStringUTF16(IDS_AX_ACTIVATE_ACTION_VERB); | 123 return l10n_util::GetStringUTF16(IDS_AX_ACTIVATE_ACTION_VERB); |
| 124 case AX_SUPPORTED_ACTION_CHECK: | 124 case AX_DEFAULT_ACTION_VERB_CHECK: |
| 125 return l10n_util::GetStringUTF16(IDS_AX_CHECK_ACTION_VERB); | 125 return l10n_util::GetStringUTF16(IDS_AX_CHECK_ACTION_VERB); |
| 126 case AX_SUPPORTED_ACTION_CLICK: | 126 case AX_DEFAULT_ACTION_VERB_CLICK: |
| 127 return l10n_util::GetStringUTF16(IDS_AX_CLICK_ACTION_VERB); | 127 return l10n_util::GetStringUTF16(IDS_AX_CLICK_ACTION_VERB); |
| 128 case AX_SUPPORTED_ACTION_JUMP: | 128 case AX_DEFAULT_ACTION_VERB_JUMP: |
| 129 return l10n_util::GetStringUTF16(IDS_AX_JUMP_ACTION_VERB); | 129 return l10n_util::GetStringUTF16(IDS_AX_JUMP_ACTION_VERB); |
| 130 case AX_SUPPORTED_ACTION_OPEN: | 130 case AX_DEFAULT_ACTION_VERB_OPEN: |
| 131 return l10n_util::GetStringUTF16(IDS_AX_OPEN_ACTION_VERB); | 131 return l10n_util::GetStringUTF16(IDS_AX_OPEN_ACTION_VERB); |
| 132 case AX_SUPPORTED_ACTION_PRESS: | 132 case AX_DEFAULT_ACTION_VERB_PRESS: |
| 133 return l10n_util::GetStringUTF16(IDS_AX_PRESS_ACTION_VERB); | 133 return l10n_util::GetStringUTF16(IDS_AX_PRESS_ACTION_VERB); |
| 134 case AX_SUPPORTED_ACTION_SELECT: | 134 case AX_DEFAULT_ACTION_VERB_SELECT: |
| 135 return l10n_util::GetStringUTF16(IDS_AX_SELECT_ACTION_VERB); | 135 return l10n_util::GetStringUTF16(IDS_AX_SELECT_ACTION_VERB); |
| 136 case AX_SUPPORTED_ACTION_UNCHECK: | 136 case AX_DEFAULT_ACTION_VERB_UNCHECK: |
| 137 return l10n_util::GetStringUTF16(IDS_AX_UNCHECK_ACTION_VERB); | 137 return l10n_util::GetStringUTF16(IDS_AX_UNCHECK_ACTION_VERB); |
| 138 } | 138 } |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 return base::string16(); | 140 return base::string16(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Some APIs on Linux and Windows need to return non-localized action names. | 143 // Some APIs on Linux and Windows need to return non-localized action names. |
| 144 base::string16 ActionToUnlocalizedString( | 144 base::string16 ActionToUnlocalizedString( |
| 145 const AXSupportedAction supported_action) { | 145 const AXDefaultActionVerb action_verb) { |
| 146 switch (supported_action) { | 146 switch (action_verb) { |
| 147 case ui::AX_SUPPORTED_ACTION_NONE: | 147 case ui::AX_DEFAULT_ACTION_VERB_NONE: |
| 148 return base::UTF8ToUTF16("none"); | 148 return base::UTF8ToUTF16("none"); |
| 149 case ui::AX_SUPPORTED_ACTION_ACTIVATE: | 149 case ui::AX_DEFAULT_ACTION_VERB_ACTIVATE: |
| 150 return base::UTF8ToUTF16("activate"); | 150 return base::UTF8ToUTF16("activate"); |
| 151 case ui::AX_SUPPORTED_ACTION_CHECK: | 151 case ui::AX_DEFAULT_ACTION_VERB_CHECK: |
| 152 return base::UTF8ToUTF16("check"); | 152 return base::UTF8ToUTF16("check"); |
| 153 case ui::AX_SUPPORTED_ACTION_CLICK: | 153 case ui::AX_DEFAULT_ACTION_VERB_CLICK: |
| 154 return base::UTF8ToUTF16("click"); | 154 return base::UTF8ToUTF16("click"); |
| 155 case ui::AX_SUPPORTED_ACTION_JUMP: | 155 case ui::AX_DEFAULT_ACTION_VERB_JUMP: |
| 156 return base::UTF8ToUTF16("jump"); | 156 return base::UTF8ToUTF16("jump"); |
| 157 case ui::AX_SUPPORTED_ACTION_OPEN: | 157 case ui::AX_DEFAULT_ACTION_VERB_OPEN: |
| 158 return base::UTF8ToUTF16("open"); | 158 return base::UTF8ToUTF16("open"); |
| 159 case ui::AX_SUPPORTED_ACTION_PRESS: | 159 case ui::AX_DEFAULT_ACTION_VERB_PRESS: |
| 160 return base::UTF8ToUTF16("press"); | 160 return base::UTF8ToUTF16("press"); |
| 161 case ui::AX_SUPPORTED_ACTION_SELECT: | 161 case ui::AX_DEFAULT_ACTION_VERB_SELECT: |
| 162 return base::UTF8ToUTF16("select"); | 162 return base::UTF8ToUTF16("select"); |
| 163 case ui::AX_SUPPORTED_ACTION_UNCHECK: | 163 case ui::AX_DEFAULT_ACTION_VERB_UNCHECK: |
| 164 return base::UTF8ToUTF16("uncheck"); | 164 return base::UTF8ToUTF16("uncheck"); |
| 165 } | 165 } |
| 166 NOTREACHED(); | 166 NOTREACHED(); |
| 167 return base::string16(); | 167 return base::string16(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace ui | 170 } // namespace ui |
| OLD | NEW |