| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 // Walks over the AXTreeUpdate and creates a light weight snapshot. | 158 // Walks over the AXTreeUpdate and creates a light weight snapshot. |
| 159 void AXTreeSnapshotCallback(const ScopedJavaGlobalRef<jobject>& callback, | 159 void AXTreeSnapshotCallback(const ScopedJavaGlobalRef<jobject>& callback, |
| 160 AccessibilitySnapshotParams* params, | 160 AccessibilitySnapshotParams* params, |
| 161 const ui::AXTreeUpdate& result) { | 161 const ui::AXTreeUpdate& result) { |
| 162 JNIEnv* env = base::android::AttachCurrentThread(); | 162 JNIEnv* env = base::android::AttachCurrentThread(); |
| 163 if (result.nodes.empty()) { | 163 if (result.nodes.empty()) { |
| 164 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); | 164 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 scoped_ptr<BrowserAccessibilityManagerAndroid> manager( | 167 std::unique_ptr<BrowserAccessibilityManagerAndroid> manager( |
| 168 static_cast<BrowserAccessibilityManagerAndroid*>( | 168 static_cast<BrowserAccessibilityManagerAndroid*>( |
| 169 BrowserAccessibilityManager::Create(result, nullptr))); | 169 BrowserAccessibilityManager::Create(result, nullptr))); |
| 170 manager->set_prune_tree_for_screen_reader(false); | 170 manager->set_prune_tree_for_screen_reader(false); |
| 171 BrowserAccessibilityAndroid* root = | 171 BrowserAccessibilityAndroid* root = |
| 172 static_cast<BrowserAccessibilityAndroid*>(manager->GetRoot()); | 172 static_cast<BrowserAccessibilityAndroid*>(manager->GetRoot()); |
| 173 if (result.has_tree_data) { | 173 if (result.has_tree_data) { |
| 174 params->has_tree_data = true; | 174 params->has_tree_data = true; |
| 175 params->sel_anchor_object_id = result.tree_data.sel_anchor_object_id; | 175 params->sel_anchor_object_id = result.tree_data.sel_anchor_object_id; |
| 176 params->sel_anchor_offset = result.tree_data.sel_anchor_offset; | 176 params->sel_anchor_offset = result.tree_data.sel_anchor_offset; |
| 177 params->sel_focus_object_id = result.tree_data.sel_focus_object_id; | 177 params->sel_focus_object_id = result.tree_data.sel_focus_object_id; |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (response == READBACK_SUCCESS) | 692 if (response == READBACK_SUCCESS) |
| 693 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); | 693 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); |
| 694 Java_WebContentsImpl_onGetContentBitmapFinished(env, | 694 Java_WebContentsImpl_onGetContentBitmapFinished(env, |
| 695 obj->obj(), | 695 obj->obj(), |
| 696 callback->obj(), | 696 callback->obj(), |
| 697 java_bitmap.obj(), | 697 java_bitmap.obj(), |
| 698 response); | 698 response); |
| 699 } | 699 } |
| 700 | 700 |
| 701 } // namespace content | 701 } // namespace content |
| OLD | NEW |