OLD | NEW |
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/web_contents/web_contents_android.h" | 5 #include "content/browser/web_contents/web_contents_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 static_cast<BrowserAccessibilityAndroid*>( | 98 static_cast<BrowserAccessibilityAndroid*>( |
99 node->PlatformGetChild(i)); | 99 node->PlatformGetChild(i)); |
100 Java_WebContentsImpl_addAccessibilityNodeAsChild(env, | 100 Java_WebContentsImpl_addAccessibilityNodeAsChild(env, |
101 j_node.obj(), WalkAXTreeDepthFirst(env, child, scale_factor, y_offset, | 101 j_node.obj(), WalkAXTreeDepthFirst(env, child, scale_factor, y_offset, |
102 x_scroll).obj()); | 102 x_scroll).obj()); |
103 } | 103 } |
104 return j_node; | 104 return j_node; |
105 } | 105 } |
106 | 106 |
107 // Walks over the AXTreeUpdate and creates a light weight snapshot. | 107 // Walks over the AXTreeUpdate and creates a light weight snapshot. |
108 void AXTreeSnapshotCallback(const ScopedJavaGlobalRef<jobject>& callback, | 108 void AXTreeSnapshotCallback( |
109 float scale_factor, | 109 const ScopedJavaGlobalRef<jobject>& callback, |
110 float y_offset, | 110 float scale_factor, |
111 float x_scroll, | 111 float y_offset, |
112 const ui::AXTreeUpdate<ui::AXNodeData>& result) { | 112 float x_scroll, |
| 113 const ui::AXTreeUpdate& result) { |
113 JNIEnv* env = base::android::AttachCurrentThread(); | 114 JNIEnv* env = base::android::AttachCurrentThread(); |
114 if (result.nodes.empty()) { | 115 if (result.nodes.empty()) { |
115 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); | 116 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); |
116 return; | 117 return; |
117 } | 118 } |
118 scoped_ptr<BrowserAccessibilityManagerAndroid> manager( | 119 scoped_ptr<BrowserAccessibilityManagerAndroid> manager( |
119 static_cast<BrowserAccessibilityManagerAndroid*>( | 120 static_cast<BrowserAccessibilityManagerAndroid*>( |
120 BrowserAccessibilityManager::Create(result, nullptr))); | 121 BrowserAccessibilityManager::Create(result, nullptr))); |
121 manager->set_prune_tree_for_screen_reader(false); | 122 manager->set_prune_tree_for_screen_reader(false); |
122 BrowserAccessibilityAndroid* root = | 123 BrowserAccessibilityAndroid* root = |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 web_contents_->StopMediaSession(); | 550 web_contents_->StopMediaSession(); |
550 } | 551 } |
551 | 552 |
552 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( | 553 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( |
553 JNIEnv* env, jobject obj) const { | 554 JNIEnv* env, jobject obj) const { |
554 return base::android::ConvertUTF8ToJavaString(env, | 555 return base::android::ConvertUTF8ToJavaString(env, |
555 web_contents_->GetEncoding()); | 556 web_contents_->GetEncoding()); |
556 } | 557 } |
557 | 558 |
558 } // namespace content | 559 } // namespace content |
OLD | NEW |