Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_input_event_router.h
blob3a2a967330a9a4a6188444cd3529364ddceb467d
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
3 // found in the LICENSE file.
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_
8 #include <stdint.h>
10 #include "base/containers/hash_tables.h"
11 #include "content/common/content_export.h"
13 namespace blink {
14 class WebMouseEvent;
15 class WebMouseWheelEvent;
18 namespace gfx {
19 class Point;
22 namespace content {
24 class RenderWidgetHostViewBase;
26 // Class owned by WebContentsImpl for the purpose of directing input events
27 // to the correct RenderWidgetHost on pages with multiple RenderWidgetHosts.
28 // It maintains a mapping of RenderWidgetHostViews to Surface IDs that they
29 // 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
31 // forwards the event to the owning RWHV of the returned Surface ID.
32 class CONTENT_EXPORT RenderWidgetHostInputEventRouter {
33 public:
34 RenderWidgetHostInputEventRouter();
35 ~RenderWidgetHostInputEventRouter();
37 void RouteMouseEvent(RenderWidgetHostViewBase* root_view,
38 blink::WebMouseEvent* event);
39 void RouteMouseWheelEvent(RenderWidgetHostViewBase* root_view,
40 blink::WebMouseWheelEvent* event);
42 void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner);
43 void RemoveSurfaceIdNamespaceOwner(uint32_t id);
45 private:
46 RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view,
47 const gfx::Point& point,
48 gfx::Point* transformed_point);
50 typedef base::hash_map<uint32_t, RenderWidgetHostViewBase*>
51 SurfaceIdNamespaceOwnerMap;
52 SurfaceIdNamespaceOwnerMap owner_map_;
54 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter);
57 } // namespace content
59 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H_