| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H_ | 
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
|  | 9 | 
|  | 10 #include <deque> | 
| 9 #include <unordered_map> | 11 #include <unordered_map> | 
| 10 | 12 | 
| 11 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" | 
|  | 14 #include "base/gtest_prod_util.h" | 
| 12 #include "base/macros.h" | 15 #include "base/macros.h" | 
| 13 #include "cc/surfaces/surface_hittest_delegate.h" | 16 #include "cc/surfaces/surface_hittest_delegate.h" | 
| 14 #include "cc/surfaces/surface_id.h" | 17 #include "cc/surfaces/surface_id.h" | 
| 15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" | 
| 16 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" | 
| 17 #include "ui/gfx/geometry/vector2d.h" | 20 #include "ui/gfx/geometry/vector2d.h" | 
| 18 | 21 | 
| 19 struct FrameHostMsg_HittestData_Params; | 22 struct FrameHostMsg_HittestData_Params; | 
| 20 | 23 | 
| 21 namespace blink { | 24 namespace blink { | 
|  | 25 class WebGestureEvent; | 
| 22 class WebMouseEvent; | 26 class WebMouseEvent; | 
| 23 class WebMouseWheelEvent; | 27 class WebMouseWheelEvent; | 
| 24 class WebTouchEvent; | 28 class WebTouchEvent; | 
| 25 } | 29 } | 
| 26 | 30 | 
| 27 namespace gfx { | 31 namespace gfx { | 
| 28 class Point; | 32 class Point; | 
| 29 } | 33 } | 
| 30 | 34 | 
| 31 namespace ui { | 35 namespace ui { | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 48   RenderWidgetHostInputEventRouter(); | 52   RenderWidgetHostInputEventRouter(); | 
| 49   ~RenderWidgetHostInputEventRouter() final; | 53   ~RenderWidgetHostInputEventRouter() final; | 
| 50 | 54 | 
| 51   void OnRenderWidgetHostViewBaseDestroyed( | 55   void OnRenderWidgetHostViewBaseDestroyed( | 
| 52       RenderWidgetHostViewBase* view) override; | 56       RenderWidgetHostViewBase* view) override; | 
| 53 | 57 | 
| 54   void RouteMouseEvent(RenderWidgetHostViewBase* root_view, | 58   void RouteMouseEvent(RenderWidgetHostViewBase* root_view, | 
| 55                        blink::WebMouseEvent* event); | 59                        blink::WebMouseEvent* event); | 
| 56   void RouteMouseWheelEvent(RenderWidgetHostViewBase* root_view, | 60   void RouteMouseWheelEvent(RenderWidgetHostViewBase* root_view, | 
| 57                             blink::WebMouseWheelEvent* event); | 61                             blink::WebMouseWheelEvent* event); | 
|  | 62   void RouteGestureEvent(RenderWidgetHostViewBase* root_view, | 
|  | 63                          blink::WebGestureEvent* event, | 
|  | 64                          const ui::LatencyInfo& latency); | 
| 58   void RouteTouchEvent(RenderWidgetHostViewBase* root_view, | 65   void RouteTouchEvent(RenderWidgetHostViewBase* root_view, | 
| 59                        blink::WebTouchEvent *event, | 66                        blink::WebTouchEvent *event, | 
| 60                        const ui::LatencyInfo& latency); | 67                        const ui::LatencyInfo& latency); | 
| 61 | 68 | 
| 62   void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); | 69   void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); | 
| 63   void RemoveSurfaceIdNamespaceOwner(uint32_t id); | 70   void RemoveSurfaceIdNamespaceOwner(uint32_t id); | 
| 64 | 71 | 
| 65   bool is_registered(uint32_t id) { | 72   bool is_registered(uint32_t id) { | 
| 66     return owner_map_.find(id) != owner_map_.end(); | 73     return owner_map_.find(id) != owner_map_.end(); | 
| 67   } | 74   } | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 82                          const gfx::Point& point_in_quad_space) override; | 89                          const gfx::Point& point_in_quad_space) override; | 
| 83     bool AcceptHitTarget(const cc::SurfaceDrawQuad* surface_quad, | 90     bool AcceptHitTarget(const cc::SurfaceDrawQuad* surface_quad, | 
| 84                          const gfx::Point& point_in_quad_space) override; | 91                          const gfx::Point& point_in_quad_space) override; | 
| 85 | 92 | 
| 86     const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& | 93     const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& | 
| 87         hittest_data_; | 94         hittest_data_; | 
| 88   }; | 95   }; | 
| 89 | 96 | 
| 90   using SurfaceIdNamespaceOwnerMap = | 97   using SurfaceIdNamespaceOwnerMap = | 
| 91       base::hash_map<uint32_t, RenderWidgetHostViewBase*>; | 98       base::hash_map<uint32_t, RenderWidgetHostViewBase*>; | 
|  | 99   struct GestureTargetData { | 
|  | 100     RenderWidgetHostViewBase* target; | 
|  | 101     const gfx::Vector2d delta; | 
|  | 102 | 
|  | 103     GestureTargetData(RenderWidgetHostViewBase* target, gfx::Vector2d delta) | 
|  | 104         : target(target), delta(delta) {} | 
|  | 105   }; | 
|  | 106   using GestureTargetQueue = std::deque<GestureTargetData>; | 
| 92 | 107 | 
| 93   void ClearAllObserverRegistrations(); | 108   void ClearAllObserverRegistrations(); | 
| 94 | 109 | 
| 95   RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, | 110   RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, | 
| 96                                             const gfx::Point& point, | 111                                             const gfx::Point& point, | 
| 97                                             gfx::Point* transformed_point); | 112                                             gfx::Point* transformed_point); | 
| 98 | 113 | 
| 99   SurfaceIdNamespaceOwnerMap owner_map_; | 114   SurfaceIdNamespaceOwnerMap owner_map_; | 
| 100   RenderWidgetHostViewBase* current_touch_target_; | 115   GestureTargetQueue gesture_target_queue_; | 
|  | 116   RenderWidgetHostViewBase* touch_target_; | 
|  | 117   RenderWidgetHostViewBase* gesture_target_; | 
| 101   gfx::Vector2d touch_delta_; | 118   gfx::Vector2d touch_delta_; | 
|  | 119   gfx::Vector2d gesture_delta_; | 
| 102   int active_touches_; | 120   int active_touches_; | 
| 103   std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash> | 121   std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash> | 
| 104       hittest_data_; | 122       hittest_data_; | 
| 105 | 123 | 
| 106   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); | 124   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); | 
|  | 125   FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, | 
|  | 126                            InputEventRouterGestureTargetQueueTest); | 
| 107 }; | 127 }; | 
| 108 | 128 | 
| 109 }  // namespace content | 129 }  // namespace content | 
| 110 | 130 | 
| 111 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
     _ | 131 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
     _ | 
| OLD | NEW | 
|---|