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