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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 15920002: Fix WebView compositor input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 7 years, 7 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.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/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "cc/layers/layer.h" 16 #include "cc/layers/layer.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/android/load_url_params.h" 18 #include "content/browser/android/load_url_params.h"
19 #include "content/browser/android/media_player_manager_impl.h" 19 #include "content/browser/android/media_player_manager_impl.h"
20 #include "content/browser/android/sync_input_event_filter.h"
21 #include "content/browser/android/touch_point.h" 20 #include "content/browser/android/touch_point.h"
22 #include "content/browser/renderer_host/compositor_impl_android.h" 21 #include "content/browser/renderer_host/compositor_impl_android.h"
23 #include "content/browser/renderer_host/java/java_bound_object.h" 22 #include "content/browser/renderer_host/java/java_bound_object.h"
24 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 23 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
25 #include "content/browser/renderer_host/render_view_host_impl.h" 24 #include "content/browser/renderer_host/render_view_host_impl.h"
26 #include "content/browser/renderer_host/render_widget_host_impl.h" 25 #include "content/browser/renderer_host/render_widget_host_impl.h"
27 #include "content/browser/renderer_host/render_widget_host_view_android.h" 26 #include "content/browser/renderer_host/render_widget_host_view_android.h"
28 #include "content/browser/ssl/ssl_host_state.h" 27 #include "content/browser/ssl/ssl_host_state.h"
29 #include "content/browser/web_contents/interstitial_page_impl.h" 28 #include "content/browser/web_contents/interstitial_page_impl.h"
30 #include "content/browser/web_contents/navigation_controller_impl.h" 29 #include "content/browser/web_contents/navigation_controller_impl.h"
31 #include "content/browser/web_contents/navigation_entry_impl.h" 30 #include "content/browser/web_contents/navigation_entry_impl.h"
32 #include "content/browser/web_contents/web_contents_view_android.h" 31 #include "content/browser/web_contents/web_contents_view_android.h"
32 #include "content/common/android/synchronous_input_event_filter.h"
33 #include "content/common/input_messages.h" 33 #include "content/common/input_messages.h"
34 #include "content/common/view_messages.h" 34 #include "content/common/view_messages.h"
35 #include "content/public/browser/browser_context.h" 35 #include "content/public/browser/browser_context.h"
36 #include "content/public/browser/favicon_status.h" 36 #include "content/public/browser/favicon_status.h"
37 #include "content/public/browser/notification_details.h" 37 #include "content/public/browser/notification_details.h"
38 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/notification_types.h" 40 #include "content/public/browser/notification_types.h"
41 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
42 #include "content/public/common/content_client.h" 42 #include "content/public/common/content_client.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj, 153 ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj,
154 bool hardware_accelerated, 154 bool hardware_accelerated,
155 WebContents* web_contents, 155 WebContents* web_contents,
156 ui::ViewAndroid* view_android, 156 ui::ViewAndroid* view_android,
157 ui::WindowAndroid* window_android) 157 ui::WindowAndroid* window_android)
158 : java_ref_(env, obj), 158 : java_ref_(env, obj),
159 web_contents_(static_cast<WebContentsImpl*>(web_contents)), 159 web_contents_(static_cast<WebContentsImpl*>(web_contents)),
160 root_layer_(cc::Layer::Create()), 160 root_layer_(cc::Layer::Create()),
161 tab_crashed_(false), 161 tab_crashed_(false),
162 view_android_(view_android), 162 view_android_(view_android),
163 window_android_(window_android) { 163 window_android_(window_android),
164 input_event_filter_(NULL) {
164 CHECK(web_contents) << 165 CHECK(web_contents) <<
165 "A ContentViewCoreImpl should be created with a valid WebContents."; 166 "A ContentViewCoreImpl should be created with a valid WebContents.";
166 167
167 // When a tab is restored (from a saved state), it does not have a renderer 168 // When a tab is restored (from a saved state), it does not have a renderer
168 // process. We treat it like the tab is crashed. If the content is loaded 169 // process. We treat it like the tab is crashed. If the content is loaded
169 // when the tab is shown, tab_crashed_ will be reset. Since 170 // when the tab is shown, tab_crashed_ will be reset. Since
170 // RenderWidgetHostView is associated with the lifetime of the renderer 171 // RenderWidgetHostView is associated with the lifetime of the renderer
171 // process, we use it to test whether there is a renderer process. 172 // process, we use it to test whether there is a renderer process.
172 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); 173 tab_crashed_ = !(web_contents->GetRenderWidgetHostView());
173 174
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 return 0.f; 667 return 0.f;
667 return Java_ContentViewCore_getOverdrawBottomHeightPix(env, j_obj.obj()) 668 return Java_ContentViewCore_getOverdrawBottomHeightPix(env, j_obj.obj())
668 / GetDpiScale(); 669 / GetDpiScale();
669 } 670 }
670 671
671 InputEventAckState ContentViewCoreImpl::FilterInputEvent( 672 InputEventAckState ContentViewCoreImpl::FilterInputEvent(
672 const WebKit::WebInputEvent& input_event) { 673 const WebKit::WebInputEvent& input_event) {
673 if (!input_event_filter_) 674 if (!input_event_filter_)
674 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 675 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
675 676
676 return input_event_filter_->HandleInputEvent(input_event); 677 RenderViewHost* host = web_contents_->GetRenderViewHost();
678 return input_event_filter_->HandleInputEvent(host->GetRoutingID(),
679 input_event);
677 } 680 }
678 681
679 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { 682 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) {
680 root_layer_->AddChild(layer); 683 root_layer_->AddChild(layer);
681 } 684 }
682 685
683 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { 686 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) {
684 layer->RemoveFromParent(); 687 layer->RemoveFromParent();
685 } 688 }
686 689
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 859 }
857 860
858 float ContentViewCoreImpl::GetTouchPaddingDip() { 861 float ContentViewCoreImpl::GetTouchPaddingDip() {
859 return 48.0f / GetDpiScale(); 862 return 48.0f / GetDpiScale();
860 } 863 }
861 864
862 float ContentViewCoreImpl::GetDpiScale() const { 865 float ContentViewCoreImpl::GetDpiScale() const {
863 return dpi_scale_; 866 return dpi_scale_;
864 } 867 }
865 868
869 void ContentViewCoreImpl::SetInputEventFilter(
870 SynchronousInputEventFilter* input_event_filter) {
871 input_event_filter_ = input_event_filter;
872 }
873
866 void ContentViewCoreImpl::RequestContentClipping( 874 void ContentViewCoreImpl::RequestContentClipping(
867 const gfx::Rect& clipping, 875 const gfx::Rect& clipping,
868 const gfx::Size& content_size) { 876 const gfx::Size& content_size) {
869 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 877 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
870 if (rwhv) 878 if (rwhv)
871 rwhv->RequestContentClipping(clipping, content_size); 879 rwhv->RequestContentClipping(clipping, content_size);
872 } 880 }
873 881
874 jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env, 882 jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env,
875 jobject obj, 883 jobject obj,
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 reinterpret_cast<ui::ViewAndroid*>(view_android), 1563 reinterpret_cast<ui::ViewAndroid*>(view_android),
1556 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1564 reinterpret_cast<ui::WindowAndroid*>(window_android));
1557 return reinterpret_cast<jint>(view); 1565 return reinterpret_cast<jint>(view);
1558 } 1566 }
1559 1567
1560 bool RegisterContentViewCore(JNIEnv* env) { 1568 bool RegisterContentViewCore(JNIEnv* env) {
1561 return RegisterNativesImpl(env); 1569 return RegisterNativesImpl(env);
1562 } 1570 }
1563 1571
1564 } // namespace content 1572 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698