OLD | NEW |
---|---|
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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "content/browser/renderer_host/render_view_host_delegate.h" | 37 #include "content/browser/renderer_host/render_view_host_delegate.h" |
38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
39 #include "content/browser/renderer_host/render_view_host_impl.h" | 39 #include "content/browser/renderer_host/render_view_host_impl.h" |
40 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 40 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
41 #include "content/browser/renderer_host/render_widget_host_impl.h" | 41 #include "content/browser/renderer_host/render_widget_host_impl.h" |
42 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 42 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
43 #include "content/browser/renderer_host/ui_events_helper.h" | 43 #include "content/browser/renderer_host/ui_events_helper.h" |
44 #include "content/browser/renderer_host/web_input_event_aura.h" | 44 #include "content/browser/renderer_host/web_input_event_aura.h" |
45 #include "content/common/gpu/client/gl_helper.h" | 45 #include "content/common/gpu/client/gl_helper.h" |
46 #include "content/common/gpu/gpu_messages.h" | 46 #include "content/common/gpu/gpu_messages.h" |
47 #include "content/common/site_isolation_policy.h" | |
47 #include "content/common/view_messages.h" | 48 #include "content/common/view_messages.h" |
48 #include "content/public/browser/content_browser_client.h" | 49 #include "content/public/browser/content_browser_client.h" |
49 #include "content/public/browser/overscroll_configuration.h" | 50 #include "content/public/browser/overscroll_configuration.h" |
50 #include "content/public/browser/render_view_host.h" | 51 #include "content/public/browser/render_view_host.h" |
51 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 52 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
52 #include "content/public/browser/user_metrics.h" | 53 #include "content/public/browser/user_metrics.h" |
53 #include "content/public/common/content_switches.h" | 54 #include "content/public/common/content_switches.h" |
54 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 55 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
55 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 56 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
56 #include "third_party/WebKit/public/web/WebInputEvent.h" | 57 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
854 ui::EF_RIGHT_MOUSE_BUTTON; | 855 ui::EF_RIGHT_MOUSE_BUTTON; |
855 return (event->flags() & kAllowedButtons) != 0; | 856 return (event->flags() & kAllowedButtons) != 0; |
856 } | 857 } |
857 default: | 858 default: |
858 break; | 859 break; |
859 } | 860 } |
860 #endif | 861 #endif |
861 return true; | 862 return true; |
862 } | 863 } |
863 | 864 |
865 bool RenderWidgetHostViewAura::ShouldRouteEvent(const ui::Event* event) const { | |
866 bool result = host_->delegate() && host_->delegate()->GetInputEventRouter(); | |
867 if (event->IsMouseEvent()) | |
Charlie Reis
2015/11/30 18:09:11
Please add a comment in this method about what pol
wjmaclean
2015/12/10 16:09:07
Done.
Charlie Reis
2015/12/10 21:58:14
I think you misunderstood my question. By default
| |
868 result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); | |
869 return result; | |
870 } | |
871 | |
864 void RenderWidgetHostViewAura::HandleParentBoundsChanged() { | 872 void RenderWidgetHostViewAura::HandleParentBoundsChanged() { |
865 SnapToPhysicalPixelBoundary(); | 873 SnapToPhysicalPixelBoundary(); |
866 #if defined(OS_WIN) | 874 #if defined(OS_WIN) |
867 if (legacy_render_widget_host_HWND_) { | 875 if (legacy_render_widget_host_HWND_) { |
868 legacy_render_widget_host_HWND_->SetBounds( | 876 legacy_render_widget_host_HWND_->SetBounds( |
869 window_->GetBoundsInRootWindow()); | 877 window_->GetBoundsInRootWindow()); |
870 } | 878 } |
871 #endif | 879 #endif |
872 if (!in_shutdown_) | 880 if (!in_shutdown_) |
873 host_->SendScreenRects(); | 881 host_->SendScreenRects(); |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2124 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 2132 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
2125 } | 2133 } |
2126 #endif | 2134 #endif |
2127 // The Disambiguation popup does not parent itself from this window, so we | 2135 // The Disambiguation popup does not parent itself from this window, so we |
2128 // manually dismiss it. | 2136 // manually dismiss it. |
2129 HideDisambiguationPopup(); | 2137 HideDisambiguationPopup(); |
2130 | 2138 |
2131 blink::WebMouseWheelEvent mouse_wheel_event = | 2139 blink::WebMouseWheelEvent mouse_wheel_event = |
2132 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 2140 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
2133 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { | 2141 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { |
2134 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 2142 if (ShouldRouteEvent(event)) { |
2135 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 2143 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
2136 this, &mouse_wheel_event); | 2144 this, &mouse_wheel_event); |
2137 } else { | 2145 } else { |
2138 ProcessMouseWheelEvent(mouse_wheel_event); | 2146 ProcessMouseWheelEvent(mouse_wheel_event); |
2139 } | 2147 } |
2140 } | 2148 } |
2141 } else { | 2149 } else { |
2142 bool is_selection_popup = | 2150 bool is_selection_popup = |
2143 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); | 2151 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); |
2144 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && | 2152 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && |
2145 !(event->flags() & ui::EF_FROM_TOUCH)) { | 2153 !(event->flags() & ui::EF_FROM_TOUCH)) { |
2146 // Confirm existing composition text on mouse press, to make sure | 2154 // Confirm existing composition text on mouse press, to make sure |
2147 // the input caret won't be moved with an ongoing composition text. | 2155 // the input caret won't be moved with an ongoing composition text. |
2148 if (event->type() == ui::ET_MOUSE_PRESSED) | 2156 if (event->type() == ui::ET_MOUSE_PRESSED) |
2149 FinishImeCompositionSession(); | 2157 FinishImeCompositionSession(); |
2150 | 2158 |
2151 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 2159 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); |
2152 ModifyEventMovementAndCoords(&mouse_event); | 2160 ModifyEventMovementAndCoords(&mouse_event); |
2153 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 2161 if (ShouldRouteEvent(event)) { |
2154 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, | 2162 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, |
2155 &mouse_event); | 2163 &mouse_event); |
2156 } else { | 2164 } else { |
2157 ProcessMouseEvent(mouse_event); | 2165 ProcessMouseEvent(mouse_event); |
2158 } | 2166 } |
2159 | 2167 |
2160 // Ensure that we get keyboard focus on mouse down as a plugin window may | 2168 // Ensure that we get keyboard focus on mouse down as a plugin window may |
2161 // have grabbed keyboard focus. | 2169 // have grabbed keyboard focus. |
2162 if (event->type() == ui::ET_MOUSE_PRESSED) | 2170 if (event->type() == ui::ET_MOUSE_PRESSED) |
2163 SetKeyboardFocus(); | 2171 SetKeyboardFocus(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2216 void RenderWidgetHostViewAura::ProcessMouseEvent( | 2224 void RenderWidgetHostViewAura::ProcessMouseEvent( |
2217 const blink::WebMouseEvent& event) { | 2225 const blink::WebMouseEvent& event) { |
2218 host_->ForwardMouseEvent(event); | 2226 host_->ForwardMouseEvent(event); |
2219 } | 2227 } |
2220 | 2228 |
2221 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 2229 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
2222 const blink::WebMouseWheelEvent& event) { | 2230 const blink::WebMouseWheelEvent& event) { |
2223 host_->ForwardWheelEvent(event); | 2231 host_->ForwardWheelEvent(event); |
2224 } | 2232 } |
2225 | 2233 |
2234 void RenderWidgetHostViewAura::ProcessTouchEvent( | |
2235 const blink::WebTouchEvent& event, | |
2236 const ui::LatencyInfo& latency) { | |
2237 host_->ForwardTouchEventWithLatencyInfo(event, latency); | |
2238 } | |
2239 | |
2226 void RenderWidgetHostViewAura::TransformPointToLocalCoordSpace( | 2240 void RenderWidgetHostViewAura::TransformPointToLocalCoordSpace( |
2227 const gfx::Point& point, | 2241 const gfx::Point& point, |
2228 cc::SurfaceId original_surface, | 2242 cc::SurfaceId original_surface, |
2229 gfx::Point* transformed_point) { | 2243 gfx::Point* transformed_point) { |
2230 delegated_frame_host_->TransformPointToLocalCoordSpace( | 2244 delegated_frame_host_->TransformPointToLocalCoordSpace( |
2231 point, original_surface, transformed_point); | 2245 point, original_surface, transformed_point); |
2232 } | 2246 } |
2233 | 2247 |
2234 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2248 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
2235 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 2249 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2290 | 2304 |
2291 // It is important to always mark events as being handled asynchronously when | 2305 // It is important to always mark events as being handled asynchronously when |
2292 // they are forwarded. This ensures that the current event does not get | 2306 // they are forwarded. This ensures that the current event does not get |
2293 // processed by the gesture recognizer before events currently awaiting | 2307 // processed by the gesture recognizer before events currently awaiting |
2294 // dispatch in the touch queue. | 2308 // dispatch in the touch queue. |
2295 event->DisableSynchronousHandling(); | 2309 event->DisableSynchronousHandling(); |
2296 | 2310 |
2297 // Set unchanged touch point to StateStationary for touchmove and | 2311 // Set unchanged touch point to StateStationary for touchmove and |
2298 // touchcancel to make sure only send one ack per WebTouchEvent. | 2312 // touchcancel to make sure only send one ack per WebTouchEvent. |
2299 MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id()); | 2313 MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id()); |
2300 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); | 2314 if (ShouldRouteEvent(event)) { |
2315 host_->delegate()->GetInputEventRouter()->RouteTouchEvent( | |
2316 this, &touch_event, *event->latency()); | |
2317 } else { | |
2318 ProcessTouchEvent(touch_event, *event->latency()); | |
2319 } | |
2301 } | 2320 } |
2302 | 2321 |
2303 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2322 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
2304 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2323 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
2305 | 2324 |
2306 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2325 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2307 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2326 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2308 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2327 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2309 event->SetHandled(); | 2328 event->SetHandled(); |
2310 return; | 2329 return; |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2978 | 2997 |
2979 //////////////////////////////////////////////////////////////////////////////// | 2998 //////////////////////////////////////////////////////////////////////////////// |
2980 // RenderWidgetHostViewBase, public: | 2999 // RenderWidgetHostViewBase, public: |
2981 | 3000 |
2982 // static | 3001 // static |
2983 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3002 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2984 GetScreenInfoForWindow(results, NULL); | 3003 GetScreenInfoForWindow(results, NULL); |
2985 } | 3004 } |
2986 | 3005 |
2987 } // namespace content | 3006 } // namespace content |
OLD | NEW |