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" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "content/browser/accessibility/browser_accessibility_android.h" | 17 #include "content/browser/accessibility/browser_accessibility_android.h" |
18 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 18 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
19 #include "content/browser/android/content_view_core_impl.h" | 19 #include "content/browser/android/content_view_core_impl.h" |
20 #include "content/browser/android/interstitial_page_delegate_android.h" | 20 #include "content/browser/android/interstitial_page_delegate_android.h" |
21 #include "content/browser/frame_host/interstitial_page_impl.h" | 21 #include "content/browser/frame_host/interstitial_page_impl.h" |
22 #include "content/browser/media/android/browser_media_player_manager.h" | 22 #include "content/browser/media/android/browser_media_player_manager.h" |
23 #include "content/browser/media/android/media_web_contents_observer_android.h" | 23 #include "content/browser/media/android/media_web_contents_observer_android.h" |
24 #include "content/browser/renderer_host/render_view_host_impl.h" | 24 #include "content/browser/renderer_host/render_view_host_impl.h" |
25 #include "content/browser/web_contents/web_contents_impl.h" | 25 #include "content/browser/web_contents/web_contents_impl.h" |
| 26 #include "content/browser/web_contents/web_contents_view.h" |
26 #include "content/common/devtools_messages.h" | 27 #include "content/common/devtools_messages.h" |
27 #include "content/common/frame_messages.h" | 28 #include "content/common/frame_messages.h" |
28 #include "content/common/input_messages.h" | 29 #include "content/common/input_messages.h" |
29 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
30 #include "content/public/browser/android/app_web_message_port_service.h" | 31 #include "content/public/browser/android/app_web_message_port_service.h" |
31 #include "content/public/browser/browser_context.h" | 32 #include "content/public/browser/browser_context.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/message_port_provider.h" | 34 #include "content/public/browser/message_port_provider.h" |
34 #include "content/public/browser/render_widget_host.h" | 35 #include "content/public/browser/render_widget_host.h" |
35 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
36 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
37 #include "jni/WebContentsImpl_jni.h" | 38 #include "jni/WebContentsImpl_jni.h" |
38 #include "net/android/network_library.h" | 39 #include "net/android/network_library.h" |
39 #include "ui/accessibility/ax_node_data.h" | 40 #include "ui/accessibility/ax_node_data.h" |
| 41 #include "ui/android/view_android.h" |
40 #include "ui/gfx/android/device_display_info.h" | 42 #include "ui/gfx/android/device_display_info.h" |
41 #include "ui/gfx/android/java_bitmap.h" | 43 #include "ui/gfx/android/java_bitmap.h" |
42 #include "ui/gfx/geometry/rect.h" | 44 #include "ui/gfx/geometry/rect.h" |
43 | 45 |
44 using base::android::AttachCurrentThread; | 46 using base::android::AttachCurrentThread; |
45 using base::android::ConvertJavaStringToUTF8; | 47 using base::android::ConvertJavaStringToUTF8; |
46 using base::android::ConvertJavaStringToUTF16; | 48 using base::android::ConvertJavaStringToUTF16; |
47 using base::android::ConvertUTF8ToJavaString; | 49 using base::android::ConvertUTF8ToJavaString; |
48 using base::android::ConvertUTF16ToJavaString; | 50 using base::android::ConvertUTF16ToJavaString; |
49 using base::android::JavaParamRef; | 51 using base::android::JavaParamRef; |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 671 } |
670 | 672 |
671 void WebContentsAndroid::DismissTextHandles( | 673 void WebContentsAndroid::DismissTextHandles( |
672 JNIEnv* env, | 674 JNIEnv* env, |
673 const base::android::JavaParamRef<jobject>& obj) { | 675 const base::android::JavaParamRef<jobject>& obj) { |
674 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 676 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
675 if (view) | 677 if (view) |
676 view->DismissTextHandles(); | 678 view->DismissTextHandles(); |
677 } | 679 } |
678 | 680 |
| 681 jlong WebContentsAndroid::GetNativeView( |
| 682 JNIEnv* env, |
| 683 const base::android::JavaParamRef<jobject>& obj) { |
| 684 return reinterpret_cast<intptr_t>(web_contents_->GetView()->GetNativeView()); |
| 685 } |
| 686 |
679 void WebContentsAndroid::OnFinishGetContentBitmap( | 687 void WebContentsAndroid::OnFinishGetContentBitmap( |
680 const JavaRef<jobject>& obj, | 688 const JavaRef<jobject>& obj, |
681 const JavaRef<jobject>& callback, | 689 const JavaRef<jobject>& callback, |
682 const SkBitmap& bitmap, | 690 const SkBitmap& bitmap, |
683 ReadbackResponse response) { | 691 ReadbackResponse response) { |
684 JNIEnv* env = base::android::AttachCurrentThread(); | 692 JNIEnv* env = base::android::AttachCurrentThread(); |
685 ScopedJavaLocalRef<jobject> java_bitmap; | 693 ScopedJavaLocalRef<jobject> java_bitmap; |
686 if (response == READBACK_SUCCESS) | 694 if (response == READBACK_SUCCESS) |
687 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); | 695 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); |
688 Java_WebContentsImpl_onGetContentBitmapFinished(env, obj, callback, | 696 Java_WebContentsImpl_onGetContentBitmapFinished(env, obj, callback, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); | 728 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); |
721 } | 729 } |
722 | 730 |
723 void WebContentsAndroid::SetMediaSession( | 731 void WebContentsAndroid::SetMediaSession( |
724 const ScopedJavaLocalRef<jobject>& j_media_session) { | 732 const ScopedJavaLocalRef<jobject>& j_media_session) { |
725 JNIEnv* env = base::android::AttachCurrentThread(); | 733 JNIEnv* env = base::android::AttachCurrentThread(); |
726 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); | 734 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); |
727 } | 735 } |
728 | 736 |
729 } // namespace content | 737 } // namespace content |
OLD | NEW |