OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/renderer_host/render_widget_host_view_event_handler.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
6 | 6 |
7 #include "base/metrics/user_metrics_action.h" | 7 #include "base/metrics/user_metrics_action.h" |
8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
9 #include "content/browser/renderer_host/overscroll_controller.h" | 9 #include "content/browser/renderer_host/overscroll_controller.h" |
10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 // 2) Touch events are always routed. In the absence of a BrowserPlugin | 843 // 2) Touch events are always routed. In the absence of a BrowserPlugin |
844 // we expect the routing to always send the event to this view. If | 844 // we expect the routing to always send the event to this view. If |
845 // one or more BrowserPlugins are present, then the event may be targeted | 845 // one or more BrowserPlugins are present, then the event may be targeted |
846 // to one of them, or this view. This allows GuestViews to have access to | 846 // to one of them, or this view. This allows GuestViews to have access to |
847 // them while still forcing pinch-zoom to be handled by the top-level | 847 // them while still forcing pinch-zoom to be handled by the top-level |
848 // frame. TODO(wjmaclean): At present, this doesn't work for OOPIF, but | 848 // frame. TODO(wjmaclean): At present, this doesn't work for OOPIF, but |
849 // it should be a simple extension to modify RenderWidgetHostViewChildFrame | 849 // it should be a simple extension to modify RenderWidgetHostViewChildFrame |
850 // in a similar manner to RenderWidgetHostViewGuest. | 850 // in a similar manner to RenderWidgetHostViewGuest. |
851 bool result = host_->delegate() && host_->delegate()->GetInputEventRouter() && | 851 bool result = host_->delegate() && host_->delegate()->GetInputEventRouter() && |
852 !disable_input_event_router_for_testing_; | 852 !disable_input_event_router_for_testing_; |
| 853 |
| 854 // Do not route events that are currently targeted to page popups such as |
| 855 // <select> element drop-downs, since these cannot contain cross-process |
| 856 // frames. |
| 857 if (host_->delegate() && !host_->delegate()->IsWidgetForMainFrame(host_)) |
| 858 return false; |
| 859 |
853 // ScrollEvents get transformed into MouseWheel events, and so are treated | 860 // ScrollEvents get transformed into MouseWheel events, and so are treated |
854 // the same as mouse events for routing purposes. | 861 // the same as mouse events for routing purposes. |
855 if (event->IsMouseEvent() || event->type() == ui::ET_SCROLL) | 862 if (event->IsMouseEvent() || event->type() == ui::ET_SCROLL) |
856 result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 863 result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
857 return result; | 864 return result; |
858 } | 865 } |
859 | 866 |
860 void RenderWidgetHostViewEventHandler::ProcessMouseEvent( | 867 void RenderWidgetHostViewEventHandler::ProcessMouseEvent( |
861 const blink::WebMouseEvent& event, | 868 const blink::WebMouseEvent& event, |
862 const ui::LatencyInfo& latency) { | 869 const ui::LatencyInfo& latency) { |
863 host_->ForwardMouseEventWithLatencyInfo(event, latency); | 870 host_->ForwardMouseEventWithLatencyInfo(event, latency); |
864 } | 871 } |
865 | 872 |
866 void RenderWidgetHostViewEventHandler::ProcessMouseWheelEvent( | 873 void RenderWidgetHostViewEventHandler::ProcessMouseWheelEvent( |
867 const blink::WebMouseWheelEvent& event, | 874 const blink::WebMouseWheelEvent& event, |
868 const ui::LatencyInfo& latency) { | 875 const ui::LatencyInfo& latency) { |
869 host_->ForwardWheelEventWithLatencyInfo(event, latency); | 876 host_->ForwardWheelEventWithLatencyInfo(event, latency); |
870 } | 877 } |
871 | 878 |
872 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( | 879 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( |
873 const blink::WebTouchEvent& event, | 880 const blink::WebTouchEvent& event, |
874 const ui::LatencyInfo& latency) { | 881 const ui::LatencyInfo& latency) { |
875 host_->ForwardTouchEventWithLatencyInfo(event, latency); | 882 host_->ForwardTouchEventWithLatencyInfo(event, latency); |
876 } | 883 } |
877 | 884 |
878 } // namespace content | 885 } // namespace content |
OLD | NEW |