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 "chrome/browser/ui/views/accessibility_event_router_views.h" | 5 #include "chrome/browser/ui/views/accessibility_event_router_views.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 std::string name; | 146 std::string name; |
147 | 147 |
148 // First see if we have a name registered for this view. | 148 // First see if we have a name registered for this view. |
149 base::hash_map<views::View*, ViewInfo>::const_iterator iter = | 149 base::hash_map<views::View*, ViewInfo>::const_iterator iter = |
150 view_info_map_.find(view); | 150 view_info_map_.find(view); |
151 if (iter != view_info_map_.end()) | 151 if (iter != view_info_map_.end()) |
152 name = iter->second.name; | 152 name = iter->second.name; |
153 | 153 |
154 // Otherwise ask the view for its accessible name. | 154 // Otherwise ask the view for its accessible name. |
155 if (name.empty()) { | 155 if (name.empty()) { |
156 std::wstring wname; | 156 string16 wname; |
157 view->GetAccessibleName(&wname); | 157 view->GetAccessibleName(&wname); |
Evan Martin
2011/01/12 20:00:51
It seems GetAccessibleName should be working with
Avi (use Gerrit)
2011/01/13 01:03:03
Re Dominic's email, this sends the name to Javascr
| |
158 name = WideToUTF8(wname); | 158 name = UTF16ToUTF8(wname); |
159 } | 159 } |
160 | 160 |
161 return name; | 161 return name; |
162 } | 162 } |
163 | 163 |
164 void AccessibilityEventRouterViews::DispatchAccessibilityNotification( | 164 void AccessibilityEventRouterViews::DispatchAccessibilityNotification( |
165 views::View* view, NotificationType type) { | 165 views::View* view, NotificationType type) { |
166 Profile* profile = NULL; | 166 Profile* profile = NULL; |
167 bool is_accessible; | 167 bool is_accessible; |
168 FindView(view, &profile, &is_accessible); | 168 FindView(view, &profile, &is_accessible); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 std::string value = WideToUTF8(location_entry->GetText()); | 296 std::string value = WideToUTF8(location_entry->GetText()); |
297 std::wstring::size_type selection_start; | 297 std::wstring::size_type selection_start; |
298 std::wstring::size_type selection_end; | 298 std::wstring::size_type selection_end; |
299 location_entry->GetSelectionBounds(&selection_start, &selection_end); | 299 location_entry->GetSelectionBounds(&selection_start, &selection_end); |
300 | 300 |
301 AccessibilityTextBoxInfo info(profile, name, false); | 301 AccessibilityTextBoxInfo info(profile, name, false); |
302 info.SetValue(value, selection_start, selection_end); | 302 info.SetValue(value, selection_start, selection_end); |
303 SendAccessibilityNotification(type, &info); | 303 SendAccessibilityNotification(type, &info); |
304 #endif | 304 #endif |
305 } | 305 } |
OLD | NEW |