| 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" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "content/browser/accessibility/browser_accessibility_android.h" | 15 #include "content/browser/accessibility/browser_accessibility_android.h" |
| 16 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
| 17 #include "content/browser/android/interstitial_page_delegate_android.h" | 17 #include "content/browser/android/interstitial_page_delegate_android.h" |
| 18 #include "content/browser/frame_host/interstitial_page_impl.h" | 18 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 19 #include "content/browser/media/android/browser_media_player_manager.h" | 19 #include "content/browser/media/android/browser_media_player_manager.h" |
| 20 #include "content/browser/media/media_web_contents_observer.h" | 20 #include "content/browser/media/media_web_contents_observer.h" |
| 21 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 22 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 23 #include "content/common/devtools_messages.h" | 23 #include "content/common/devtools_messages.h" |
| 24 #include "content/common/frame_messages.h" | 24 #include "content/common/frame_messages.h" |
| 25 #include "content/common/input_messages.h" | 25 #include "content/common/input_messages.h" |
| 26 #include "content/common/view_messages.h" | 26 #include "content/common/view_messages.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Walks over the AXTreeUpdate and creates a light weight snapshot. | 100 // Walks over the AXTreeUpdate and creates a light weight snapshot. |
| 101 void AXTreeSnapshotCallback(const ScopedJavaGlobalRef<jobject>& callback, | 101 void AXTreeSnapshotCallback(const ScopedJavaGlobalRef<jobject>& callback, |
| 102 const ui::AXTreeUpdate& result) { | 102 const ui::AXTreeUpdate& result) { |
| 103 JNIEnv* env = base::android::AttachCurrentThread(); | 103 JNIEnv* env = base::android::AttachCurrentThread(); |
| 104 if (result.nodes.empty()) { | 104 if (result.nodes.empty()) { |
| 105 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); | 105 Java_WebContentsImpl_onAccessibilitySnapshot(env, nullptr, callback.obj()); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 scoped_ptr<BrowserAccessibilityManager> manager( | 108 scoped_ptr<BrowserAccessibilityManagerAndroid> manager( |
| 109 BrowserAccessibilityManager::Create(result, nullptr)); | 109 static_cast<BrowserAccessibilityManagerAndroid*>( |
| 110 BrowserAccessibilityManager::Create(result, nullptr))); |
| 111 manager->set_prune_tree_for_screen_reader(false); |
| 110 BrowserAccessibilityAndroid* root = | 112 BrowserAccessibilityAndroid* root = |
| 111 static_cast<BrowserAccessibilityAndroid*>(manager->GetRoot()); | 113 static_cast<BrowserAccessibilityAndroid*>(manager->GetRoot()); |
| 112 ScopedJavaLocalRef<jobject> j_root = WalkAXTreeDepthFirst(env, root); | 114 ScopedJavaLocalRef<jobject> j_root = WalkAXTreeDepthFirst(env, root); |
| 113 Java_WebContentsImpl_onAccessibilitySnapshot( | 115 Java_WebContentsImpl_onAccessibilitySnapshot( |
| 114 env, j_root.obj(), callback.obj()); | 116 env, j_root.obj(), callback.obj()); |
| 115 } | 117 } |
| 116 | 118 |
| 117 void ReleaseAllMediaPlayers(WebContents* web_contents, | 119 void ReleaseAllMediaPlayers(WebContents* web_contents, |
| 118 RenderFrameHost* render_frame_host) { | 120 RenderFrameHost* render_frame_host) { |
| 119 BrowserMediaPlayerManager* manager = | 121 BrowserMediaPlayerManager* manager = |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 ScopedJavaGlobalRef<jobject> j_callback; | 435 ScopedJavaGlobalRef<jobject> j_callback; |
| 434 j_callback.Reset(env, callback); | 436 j_callback.Reset(env, callback); |
| 435 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = | 437 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = |
| 436 base::Bind(&AXTreeSnapshotCallback, j_callback); | 438 base::Bind(&AXTreeSnapshotCallback, j_callback); |
| 437 | 439 |
| 438 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( | 440 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( |
| 439 snapshot_callback); | 441 snapshot_callback); |
| 440 } | 442 } |
| 441 | 443 |
| 442 } // namespace content | 444 } // namespace content |
| OLD | NEW |