Chromium Code Reviews| 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_android.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" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 snapshot_callback); | 610 snapshot_callback); |
| 610 } | 611 } |
| 611 | 612 |
| 612 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( | 613 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( |
| 613 JNIEnv* env, | 614 JNIEnv* env, |
| 614 const JavaParamRef<jobject>& obj) const { | 615 const JavaParamRef<jobject>& obj) const { |
| 615 return base::android::ConvertUTF8ToJavaString(env, | 616 return base::android::ConvertUTF8ToJavaString(env, |
| 616 web_contents_->GetEncoding()); | 617 web_contents_->GetEncoding()); |
| 617 } | 618 } |
| 618 | 619 |
| 620 void WebContentsAndroid::SetOverscrollRefreshHandler( | |
| 621 JNIEnv* env, | |
| 622 const base::android::JavaParamRef<jobject>& obj, | |
| 623 const base::android::JavaParamRef<jobject>& overscroll_refresh_handler) { | |
| 624 WebContentsViewAndroid* view = | |
| 625 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | |
| 626 auto native_overscroll_refresh_handler = | |
| 627 base::MakeUnique<ui::OverscrollRefreshHandler>( | |
| 628 overscroll_refresh_handler); | |
| 629 view->SetOverscrollRefreshHandler( | |
| 630 std::move(native_overscroll_refresh_handler)); | |
|
boliu
2016/12/03 01:05:28
nit: you can write these two statements in one, wh
rlanday
2016/12/05 19:53:56
Ok
| |
| 631 } | |
| 632 | |
| 619 void WebContentsAndroid::GetContentBitmap( | 633 void WebContentsAndroid::GetContentBitmap( |
| 620 JNIEnv* env, | 634 JNIEnv* env, |
| 621 const JavaParamRef<jobject>& obj, | 635 const JavaParamRef<jobject>& obj, |
| 622 const JavaParamRef<jobject>& jcallback, | 636 const JavaParamRef<jobject>& jcallback, |
| 623 const JavaParamRef<jobject>& color_type, | 637 const JavaParamRef<jobject>& color_type, |
| 624 jfloat scale, | 638 jfloat scale, |
| 625 jfloat x, | 639 jfloat x, |
| 626 jfloat y, | 640 jfloat y, |
| 627 jfloat width, | 641 jfloat width, |
| 628 jfloat height) { | 642 jfloat height) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); | 734 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); |
| 721 } | 735 } |
| 722 | 736 |
| 723 void WebContentsAndroid::SetMediaSession( | 737 void WebContentsAndroid::SetMediaSession( |
| 724 const ScopedJavaLocalRef<jobject>& j_media_session) { | 738 const ScopedJavaLocalRef<jobject>& j_media_session) { |
| 725 JNIEnv* env = base::android::AttachCurrentThread(); | 739 JNIEnv* env = base::android::AttachCurrentThread(); |
| 726 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); | 740 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); |
| 727 } | 741 } |
| 728 | 742 |
| 729 } // namespace content | 743 } // namespace content |
| OLD | NEW |