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 "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/strings/grit/ui_strings.h" |
10 | 12 |
11 namespace ui { | 13 namespace ui { |
12 | 14 |
13 // line_breaks is a Misnomer. Blink provides the start offsets of each line | 15 // line_breaks is a Misnomer. Blink provides the start offsets of each line |
14 // not the line breaks. | 16 // not the line breaks. |
15 // TODO(nektar): Rename line_breaks a11y attribute and variable references. | 17 // TODO(nektar): Rename line_breaks a11y attribute and variable references. |
16 size_t FindAccessibleTextBoundary(const base::string16& text, | 18 size_t FindAccessibleTextBoundary(const base::string16& text, |
17 const std::vector<int>& line_breaks, | 19 const std::vector<int>& line_breaks, |
18 TextBoundaryType boundary, | 20 TextBoundaryType boundary, |
19 size_t start_offset, | 21 size_t start_offset, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 107 } |
106 | 108 |
107 if (direction == FORWARDS_DIRECTION) { | 109 if (direction == FORWARDS_DIRECTION) { |
108 result++; | 110 result++; |
109 } else { | 111 } else { |
110 result--; | 112 result--; |
111 } | 113 } |
112 } | 114 } |
113 } | 115 } |
114 | 116 |
| 117 base::string16 ActionToString(const AXSupportedAction supported_action) { |
| 118 switch (supported_action) { |
| 119 case AX_SUPPORTED_ACTION_NONE: |
| 120 return base::string16(); |
| 121 case AX_SUPPORTED_ACTION_ACTIVATE: |
| 122 return l10n_util::GetStringUTF16(IDS_AX_ACTIVATE_ACTION_VERB); |
| 123 case AX_SUPPORTED_ACTION_CHECK: |
| 124 return l10n_util::GetStringUTF16(IDS_AX_CHECK_ACTION_VERB); |
| 125 case AX_SUPPORTED_ACTION_CLICK: |
| 126 return l10n_util::GetStringUTF16(IDS_AX_CLICK_ACTION_VERB); |
| 127 case AX_SUPPORTED_ACTION_JUMP: |
| 128 return l10n_util::GetStringUTF16(IDS_AX_JUMP_ACTION_VERB); |
| 129 case AX_SUPPORTED_ACTION_OPEN: |
| 130 return l10n_util::GetStringUTF16(IDS_AX_OPEN_ACTION_VERB); |
| 131 case AX_SUPPORTED_ACTION_PRESS: |
| 132 return l10n_util::GetStringUTF16(IDS_AX_PRESS_ACTION_VERB); |
| 133 case AX_SUPPORTED_ACTION_SELECT: |
| 134 return l10n_util::GetStringUTF16(IDS_AX_SELECT_ACTION_VERB); |
| 135 case AX_SUPPORTED_ACTION_UNCHECK: |
| 136 return l10n_util::GetStringUTF16(IDS_AX_UNCHECK_ACTION_VERB); |
| 137 } |
| 138 NOTREACHED(); |
| 139 return base::string16(); |
| 140 } |
| 141 |
115 } // namespace ui | 142 } // namespace ui |
OLD | NEW |