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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_android.cc

Issue 1884723003: Accessible location change events need to update internal data structure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « content/browser/accessibility/browser_accessibility_manager_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/accessibility/browser_accessibility_manager_android.h" 5 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 BrowserAccessibilityAndroid* android_node = 202 BrowserAccessibilityAndroid* android_node =
203 static_cast<BrowserAccessibilityAndroid*>(node); 203 static_cast<BrowserAccessibilityAndroid*>(node);
204 204
205 if (event_type == ui::AX_EVENT_HIDE) 205 if (event_type == ui::AX_EVENT_HIDE)
206 return; 206 return;
207 207
208 if (event_type == ui::AX_EVENT_TREE_CHANGED) 208 if (event_type == ui::AX_EVENT_TREE_CHANGED)
209 return; 209 return;
210 210
211 // Layout changes are handled in OnLocationChanges. 211 // Layout changes are handled in OnLocationChanges and
212 // SendLocationChangeEvents.
212 if (event_type == ui::AX_EVENT_LAYOUT_COMPLETE) 213 if (event_type == ui::AX_EVENT_LAYOUT_COMPLETE)
213 return; 214 return;
214 215
215 if (event_type == ui::AX_EVENT_HOVER) { 216 if (event_type == ui::AX_EVENT_HOVER) {
216 HandleHoverEvent(node); 217 HandleHoverEvent(node);
217 return; 218 return;
218 } 219 }
219 220
220 // Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify 221 // Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify
221 // the Android system that the accessibility hierarchy rooted at this 222 // the Android system that the accessibility hierarchy rooted at this
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 env, obj.obj(), node->unique_id()); 275 env, obj.obj(), node->unique_id());
275 } 276 }
276 break; 277 break;
277 default: 278 default:
278 // There are some notifications that aren't meaningful on Android. 279 // There are some notifications that aren't meaningful on Android.
279 // It's okay to skip them. 280 // It's okay to skip them.
280 break; 281 break;
281 } 282 }
282 } 283 }
283 284
284 void BrowserAccessibilityManagerAndroid::OnLocationChanges( 285 void BrowserAccessibilityManagerAndroid::SendLocationChangeEvents(
285 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { 286 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) {
286 // Android is not very efficient at handling notifications, and location 287 // Android is not very efficient at handling notifications, and location
287 // changes in particular are frequent and not time-critical. If a lot of 288 // changes in particular are frequent and not time-critical. If a lot of
288 // nodes changed location, just send a single notification after a short 289 // nodes changed location, just send a single notification after a short
289 // delay (to batch them), rather than lots of individual notifications. 290 // delay (to batch them), rather than lots of individual notifications.
290 if (params.size() > 3) { 291 if (params.size() > 3) {
291 ScopedJavaLocalRef<jobject> obj = GetJavaRefFromRootManager(); 292 ScopedJavaLocalRef<jobject> obj = GetJavaRefFromRootManager();
292 JNIEnv* env = AttachCurrentThread(); 293 JNIEnv* env = AttachCurrentThread();
293 if (obj.is_null()) 294 if (obj.is_null())
294 return; 295 return;
295 Java_BrowserAccessibilityManager_sendDelayedWindowContentChangedEvent( 296 Java_BrowserAccessibilityManager_sendDelayedWindowContentChangedEvent(
296 env, obj.obj()); 297 env, obj.obj());
297 return; 298 return;
298 } 299 }
299 300
300 BrowserAccessibilityManager::OnLocationChanges(params); 301 BrowserAccessibilityManager::SendLocationChangeEvents(params);
301 } 302 }
302 303
303 base::android::ScopedJavaLocalRef<jstring> 304 base::android::ScopedJavaLocalRef<jstring>
304 BrowserAccessibilityManagerAndroid::GetSupportedHtmlElementTypes( 305 BrowserAccessibilityManagerAndroid::GetSupportedHtmlElementTypes(
305 JNIEnv* env, 306 JNIEnv* env,
306 const JavaParamRef<jobject>& obj) { 307 const JavaParamRef<jobject>& obj) {
307 InitSearchKeyToPredicateMapIfNeeded(); 308 InitSearchKeyToPredicateMapIfNeeded();
308 return base::android::ConvertUTF16ToJavaString(env, g_all_search_keys.Get()); 309 return base::android::ConvertUTF16ToJavaString(env, g_all_search_keys.Get());
309 } 310 }
310 311
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 940
940 JNIEnv* env = AttachCurrentThread(); 941 JNIEnv* env = AttachCurrentThread();
941 return root_manager->java_ref().get(env); 942 return root_manager->java_ref().get(env);
942 } 943 }
943 944
944 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { 945 bool RegisterBrowserAccessibilityManager(JNIEnv* env) {
945 return RegisterNativesImpl(env); 946 return RegisterNativesImpl(env);
946 } 947 }
947 948
948 } // namespace content 949 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698