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

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

Issue 23481011: Send Android accessibility "content changed" event for any change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 | « no previous file | content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java » ('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 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 <cmath> 7 #include <cmath>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent( 85 void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
86 WebKit::WebAXEvent event_type, 86 WebKit::WebAXEvent event_type,
87 BrowserAccessibility* node) { 87 BrowserAccessibility* node) {
88 JNIEnv* env = AttachCurrentThread(); 88 JNIEnv* env = AttachCurrentThread();
89 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 89 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
90 if (obj.is_null()) 90 if (obj.is_null())
91 return; 91 return;
92 92
93 // Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify
94 // the Android system that the accessibility hierarchy rooted at this
95 // node has changed.
96 Java_BrowserAccessibilityManager_handleContentChanged(
97 env, obj.obj(), node->renderer_id());
joth 2013/09/06 18:50:21 to check, is |node| guaranteed to be non-null?
dmazzoni 2013/09/06 19:33:33 Yes, it won't ever be null.
98
93 switch (event_type) { 99 switch (event_type) {
94 case WebKit::WebAXEventLoadComplete: 100 case WebKit::WebAXEventLoadComplete:
95 Java_BrowserAccessibilityManager_handlePageLoaded( 101 Java_BrowserAccessibilityManager_handlePageLoaded(
96 env, obj.obj(), focus_->renderer_id()); 102 env, obj.obj(), focus_->renderer_id());
97 break; 103 break;
98 case WebKit::WebAXEventFocus: 104 case WebKit::WebAXEventFocus:
99 Java_BrowserAccessibilityManager_handleFocusChanged( 105 Java_BrowserAccessibilityManager_handleFocusChanged(
100 env, obj.obj(), node->renderer_id()); 106 env, obj.obj(), node->renderer_id());
101 break; 107 break;
102 case WebKit::WebAXEventCheckedStateChanged: 108 case WebKit::WebAXEventCheckedStateChanged:
(...skipping 21 matching lines...) Expand all
124 case WebKit::WebAXEventSelectedTextChanged: 130 case WebKit::WebAXEventSelectedTextChanged:
125 Java_BrowserAccessibilityManager_handleTextSelectionChanged( 131 Java_BrowserAccessibilityManager_handleTextSelectionChanged(
126 env, obj.obj(), node->renderer_id()); 132 env, obj.obj(), node->renderer_id());
127 break; 133 break;
128 case WebKit::WebAXEventChildrenChanged: 134 case WebKit::WebAXEventChildrenChanged:
129 case WebKit::WebAXEventTextChanged: 135 case WebKit::WebAXEventTextChanged:
130 case WebKit::WebAXEventValueChanged: 136 case WebKit::WebAXEventValueChanged:
131 if (node->IsEditableText()) { 137 if (node->IsEditableText()) {
132 Java_BrowserAccessibilityManager_handleEditableTextChanged( 138 Java_BrowserAccessibilityManager_handleEditableTextChanged(
133 env, obj.obj(), node->renderer_id()); 139 env, obj.obj(), node->renderer_id());
134 } else {
135 Java_BrowserAccessibilityManager_handleContentChanged(
136 env, obj.obj(), node->renderer_id());
137 } 140 }
138 break; 141 break;
139 default: 142 default:
140 // There are some notifications that aren't meaningful on Android. 143 // There are some notifications that aren't meaningful on Android.
141 // It's okay to skip them. 144 // It's okay to skip them.
142 break; 145 break;
143 } 146 }
144 } 147 }
145 148
146 jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) { 149 jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() { 360 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() {
358 // The Java layer handles the root scroll offset. 361 // The Java layer handles the root scroll offset.
359 return false; 362 return false;
360 } 363 }
361 364
362 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { 365 bool RegisterBrowserAccessibilityManager(JNIEnv* env) {
363 return RegisterNativesImpl(env); 366 return RegisterNativesImpl(env);
364 } 367 }
365 368
366 } // namespace content 369 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698