Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: content/browser/web_contents/web_contents_android.cc

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Respond to more comments, all test cases should pass now Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
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/overscroll_refresh_handler.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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 snapshot_callback); 611 snapshot_callback);
610 } 612 }
611 613
612 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( 614 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding(
613 JNIEnv* env, 615 JNIEnv* env,
614 const JavaParamRef<jobject>& obj) const { 616 const JavaParamRef<jobject>& obj) const {
615 return base::android::ConvertUTF8ToJavaString(env, 617 return base::android::ConvertUTF8ToJavaString(env,
616 web_contents_->GetEncoding()); 618 web_contents_->GetEncoding());
617 } 619 }
618 620
621 void WebContentsAndroid::SetOverscrollRefreshHandler(
622 JNIEnv* env,
623 const base::android::JavaParamRef<jobject>& obj,
624 const base::android::JavaParamRef<jobject>& overscroll_refresh_handler) {
625 WebContentsViewAndroid* view =
626 static_cast<WebContentsViewAndroid*>(web_contents_->GetView());
627 view->SetOverscrollRefreshHandler(
628 base::MakeUnique<ui::OverscrollRefreshHandler>(
629 overscroll_refresh_handler));
630 }
631
619 void WebContentsAndroid::GetContentBitmap( 632 void WebContentsAndroid::GetContentBitmap(
620 JNIEnv* env, 633 JNIEnv* env,
621 const JavaParamRef<jobject>& obj, 634 const JavaParamRef<jobject>& obj,
622 const JavaParamRef<jobject>& jcallback, 635 const JavaParamRef<jobject>& jcallback,
623 const JavaParamRef<jobject>& color_type, 636 const JavaParamRef<jobject>& color_type,
624 jfloat scale, 637 jfloat scale,
625 jfloat x, 638 jfloat x,
626 jfloat y, 639 jfloat y,
627 jfloat width, 640 jfloat width,
628 jfloat height) { 641 jfloat height) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); 733 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes);
721 } 734 }
722 735
723 void WebContentsAndroid::SetMediaSession( 736 void WebContentsAndroid::SetMediaSession(
724 const ScopedJavaLocalRef<jobject>& j_media_session) { 737 const ScopedJavaLocalRef<jobject>& j_media_session) {
725 JNIEnv* env = base::android::AttachCurrentThread(); 738 JNIEnv* env = base::android::AttachCurrentThread();
726 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); 739 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session);
727 } 740 }
728 741
729 } // namespace content 742 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698