| 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 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 class WebMouseEvent; | 14 class WebMouseEvent; |
| 15 class WebMouseWheelEvent; | 15 class WebMouseWheelEvent; |
| 16 class WebTouchEvent; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class Point; | 20 class Point; |
| 20 } | 21 } |
| 21 | 22 |
| 23 namespace ui { |
| 24 class LatencyInfo; |
| 25 } |
| 26 |
| 22 namespace content { | 27 namespace content { |
| 23 | 28 |
| 24 class RenderWidgetHostViewBase; | 29 class RenderWidgetHostViewBase; |
| 25 | 30 |
| 26 // Class owned by WebContentsImpl for the purpose of directing input events | 31 // Class owned by WebContentsImpl for the purpose of directing input events |
| 27 // to the correct RenderWidgetHost on pages with multiple RenderWidgetHosts. | 32 // to the correct RenderWidgetHost on pages with multiple RenderWidgetHosts. |
| 28 // It maintains a mapping of RenderWidgetHostViews to Surface IDs that they | 33 // It maintains a mapping of RenderWidgetHostViews to Surface IDs that they |
| 29 // own. When an input event requires routing based on window coordinates, | 34 // own. When an input event requires routing based on window coordinates, |
| 30 // this class requests a Surface hit test from the provided |root_view| and | 35 // this class requests a Surface hit test from the provided |root_view| and |
| 31 // forwards the event to the owning RWHV of the returned Surface ID. | 36 // forwards the event to the owning RWHV of the returned Surface ID. |
| 32 class CONTENT_EXPORT RenderWidgetHostInputEventRouter { | 37 class CONTENT_EXPORT RenderWidgetHostInputEventRouter { |
| 33 public: | 38 public: |
| 34 RenderWidgetHostInputEventRouter(); | 39 RenderWidgetHostInputEventRouter(); |
| 35 ~RenderWidgetHostInputEventRouter(); | 40 ~RenderWidgetHostInputEventRouter(); |
| 36 | 41 |
| 37 void RouteMouseEvent(RenderWidgetHostViewBase* root_view, | 42 void RouteMouseEvent(RenderWidgetHostViewBase* root_view, |
| 38 blink::WebMouseEvent* event); | 43 blink::WebMouseEvent* event); |
| 39 void RouteMouseWheelEvent(RenderWidgetHostViewBase* root_view, | 44 void RouteMouseWheelEvent(RenderWidgetHostViewBase* root_view, |
| 40 blink::WebMouseWheelEvent* event); | 45 blink::WebMouseWheelEvent* event); |
| 46 void RouteTouchEvent(RenderWidgetHostViewBase* root_view, |
| 47 blink::WebTouchEvent *event, |
| 48 const ui::LatencyInfo& latency); |
| 41 | 49 |
| 42 void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); | 50 void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); |
| 43 void RemoveSurfaceIdNamespaceOwner(uint32_t id); | 51 void RemoveSurfaceIdNamespaceOwner(uint32_t id); |
| 44 | 52 |
| 53 bool is_registered(uint32_t id) { |
| 54 return owner_map_.find(id) != owner_map_.end(); |
| 55 } |
| 56 |
| 45 private: | 57 private: |
| 46 RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, | 58 RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, |
| 47 const gfx::Point& point, | 59 const gfx::Point& point, |
| 48 gfx::Point* transformed_point); | 60 gfx::Point* transformed_point); |
| 49 | 61 |
| 50 typedef base::hash_map<uint32_t, RenderWidgetHostViewBase*> | 62 typedef base::hash_map<uint32_t, RenderWidgetHostViewBase*> |
| 51 SurfaceIdNamespaceOwnerMap; | 63 SurfaceIdNamespaceOwnerMap; |
| 52 SurfaceIdNamespaceOwnerMap owner_map_; | 64 SurfaceIdNamespaceOwnerMap owner_map_; |
| 65 RenderWidgetHostViewBase* current_touch_target_; |
| 66 int active_touches_; |
| 53 | 67 |
| 54 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); | 68 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); |
| 55 }; | 69 }; |
| 56 | 70 |
| 57 } // namespace content | 71 } // namespace content |
| 58 | 72 |
| 59 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
_ | 73 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
_ |
| OLD | NEW |