| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // 2) Touch events are always routed. In the absence of a BrowserPlugin | 857 // 2) Touch events are always routed. In the absence of a BrowserPlugin |
| 858 // we expect the routing to always send the event to this view. If | 858 // we expect the routing to always send the event to this view. If |
| 859 // one or more BrowserPlugins are present, then the event may be targeted | 859 // one or more BrowserPlugins are present, then the event may be targeted |
| 860 // to one of them, or this view. This allows GuestViews to have access to | 860 // to one of them, or this view. This allows GuestViews to have access to |
| 861 // them while still forcing pinch-zoom to be handled by the top-level | 861 // them while still forcing pinch-zoom to be handled by the top-level |
| 862 // frame. TODO(wjmaclean): At present, this doesn't work for OOPIF, but | 862 // frame. TODO(wjmaclean): At present, this doesn't work for OOPIF, but |
| 863 // it should be a simple extension to modify RenderWidgetHostViewChildFrame | 863 // it should be a simple extension to modify RenderWidgetHostViewChildFrame |
| 864 // in a similar manner to RenderWidgetHostViewGuest. | 864 // in a similar manner to RenderWidgetHostViewGuest. |
| 865 bool result = host_->delegate() && host_->delegate()->GetInputEventRouter() && | 865 bool result = host_->delegate() && host_->delegate()->GetInputEventRouter() && |
| 866 !disable_input_event_router_for_testing_; | 866 !disable_input_event_router_for_testing_; |
| 867 if (event->IsMouseEvent()) | 867 // ScrollEvents get transformed into MouseWheel events, and so are treated |
| 868 // the same as mouse events for routing purposes. |
| 869 if (event->IsMouseEvent() || event->type() == ui::ET_SCROLL) |
| 868 result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 870 result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
| 869 return result; | 871 return result; |
| 870 } | 872 } |
| 871 | 873 |
| 872 void RenderWidgetHostViewAura::HandleParentBoundsChanged() { | 874 void RenderWidgetHostViewAura::HandleParentBoundsChanged() { |
| 873 SnapToPhysicalPixelBoundary(); | 875 SnapToPhysicalPixelBoundary(); |
| 874 #if defined(OS_WIN) | 876 #if defined(OS_WIN) |
| 875 if (legacy_render_widget_host_HWND_) { | 877 if (legacy_render_widget_host_HWND_) { |
| 876 legacy_render_widget_host_HWND_->SetBounds( | 878 legacy_render_widget_host_HWND_->SetBounds( |
| 877 window_->GetBoundsInRootWindow()); | 879 window_->GetBoundsInRootWindow()); |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 | 2122 |
| 2121 if (event->type() == ui::ET_SCROLL) { | 2123 if (event->type() == ui::ET_SCROLL) { |
| 2122 #if !defined(OS_WIN) | 2124 #if !defined(OS_WIN) |
| 2123 // TODO(ananta) | 2125 // TODO(ananta) |
| 2124 // Investigate if this is true for Windows 8 Metro ASH as well. | 2126 // Investigate if this is true for Windows 8 Metro ASH as well. |
| 2125 if (event->finger_count() != 2) | 2127 if (event->finger_count() != 2) |
| 2126 return; | 2128 return; |
| 2127 #endif | 2129 #endif |
| 2128 blink::WebGestureEvent gesture_event = | 2130 blink::WebGestureEvent gesture_event = |
| 2129 MakeWebGestureEventFlingCancel(); | 2131 MakeWebGestureEventFlingCancel(); |
| 2130 host_->ForwardGestureEvent(gesture_event); | 2132 // Coordinates need to be transferred to the fling cancel gesture only |
| 2133 // for Surface-targeting to ensure that it is targeted to the correct |
| 2134 // RenderWidgetHost. |
| 2135 gesture_event.x = event->x(); |
| 2136 gesture_event.y = event->y(); |
| 2131 blink::WebMouseWheelEvent mouse_wheel_event = | 2137 blink::WebMouseWheelEvent mouse_wheel_event = |
| 2132 MakeWebMouseWheelEvent(*event); | 2138 MakeWebMouseWheelEvent(*event); |
| 2133 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, | 2139 if (ShouldRouteEvent(event)) { |
| 2134 *event->latency()); | 2140 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 2141 this, &gesture_event, ui::LatencyInfo()); |
| 2142 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| 2143 this, &mouse_wheel_event); |
| 2144 } else { |
| 2145 host_->ForwardGestureEvent(gesture_event); |
| 2146 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, |
| 2147 *event->latency()); |
| 2148 } |
| 2135 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 2149 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
| 2136 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2150 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2137 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2151 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2138 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 2152 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
| 2139 host_->ForwardGestureEvent(gesture_event); | 2153 if (ShouldRouteEvent(event)) { |
| 2154 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 2155 this, &gesture_event, ui::LatencyInfo()); |
| 2156 } else { |
| 2157 host_->ForwardGestureEvent(gesture_event); |
| 2158 } |
| 2140 if (event->type() == ui::ET_SCROLL_FLING_START) | 2159 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2141 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 2160 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
| 2142 } | 2161 } |
| 2143 | 2162 |
| 2144 event->SetHandled(); | 2163 event->SetHandled(); |
| 2145 } | 2164 } |
| 2146 | 2165 |
| 2147 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2166 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| 2148 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 2167 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
| 2149 | 2168 |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 | 3040 |
| 3022 //////////////////////////////////////////////////////////////////////////////// | 3041 //////////////////////////////////////////////////////////////////////////////// |
| 3023 // RenderWidgetHostViewBase, public: | 3042 // RenderWidgetHostViewBase, public: |
| 3024 | 3043 |
| 3025 // static | 3044 // static |
| 3026 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3045 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3027 GetScreenInfoForWindow(results, NULL); | 3046 GetScreenInfoForWindow(results, NULL); |
| 3028 } | 3047 } |
| 3029 | 3048 |
| 3030 } // namespace content | 3049 } // namespace content |
| OLD | NEW |