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 #include <unordered_map> | |
10 | 9 |
11 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
14 #include "cc/surfaces/surface_hittest_delegate.h" | |
15 #include "cc/surfaces/surface_id.h" | |
16 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
17 | 14 |
18 struct FrameHostMsg_HittestData_Params; | |
19 | |
20 namespace blink { | 15 namespace blink { |
21 class WebMouseEvent; | 16 class WebMouseEvent; |
22 class WebMouseWheelEvent; | 17 class WebMouseWheelEvent; |
23 class WebTouchEvent; | 18 class WebTouchEvent; |
24 } | 19 } |
25 | 20 |
26 namespace gfx { | 21 namespace gfx { |
27 class Point; | 22 class Point; |
28 } | 23 } |
29 | 24 |
(...skipping 24 matching lines...) Expand all Loading... |
54 blink::WebTouchEvent *event, | 49 blink::WebTouchEvent *event, |
55 const ui::LatencyInfo& latency); | 50 const ui::LatencyInfo& latency); |
56 | 51 |
57 void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); | 52 void AddSurfaceIdNamespaceOwner(uint32_t id, RenderWidgetHostViewBase* owner); |
58 void RemoveSurfaceIdNamespaceOwner(uint32_t id); | 53 void RemoveSurfaceIdNamespaceOwner(uint32_t id); |
59 | 54 |
60 bool is_registered(uint32_t id) { | 55 bool is_registered(uint32_t id) { |
61 return owner_map_.find(id) != owner_map_.end(); | 56 return owner_map_.find(id) != owner_map_.end(); |
62 } | 57 } |
63 | 58 |
64 void OnHittestData(const FrameHostMsg_HittestData_Params& params); | |
65 | |
66 private: | 59 private: |
67 struct HittestData { | |
68 bool ignored_for_hittest; | |
69 }; | |
70 | |
71 class HittestDelegate : public cc::SurfaceHittestDelegate { | |
72 public: | |
73 HittestDelegate( | |
74 const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& | |
75 hittest_data); | |
76 bool RejectHitTarget(const cc::SurfaceDrawQuad* surface_quad, | |
77 const gfx::Point& point_in_quad_space) override; | |
78 | |
79 const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& | |
80 hittest_data_; | |
81 }; | |
82 | |
83 using WeakTarget = base::WeakPtr<RenderWidgetHostViewBase>; | 60 using WeakTarget = base::WeakPtr<RenderWidgetHostViewBase>; |
84 using SurfaceIdNamespaceOwnerMap = | 61 using SurfaceIdNamespaceOwnerMap = |
85 base::hash_map<uint32_t, base::WeakPtr<RenderWidgetHostViewBase>>; | 62 base::hash_map<uint32_t, base::WeakPtr<RenderWidgetHostViewBase>>; |
86 | 63 |
87 RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, | 64 RenderWidgetHostViewBase* FindEventTarget(RenderWidgetHostViewBase* root_view, |
88 const gfx::Point& point, | 65 const gfx::Point& point, |
89 gfx::Point* transformed_point); | 66 gfx::Point* transformed_point); |
90 | 67 |
91 SurfaceIdNamespaceOwnerMap owner_map_; | 68 SurfaceIdNamespaceOwnerMap owner_map_; |
92 WeakTarget current_touch_target_; | 69 WeakTarget current_touch_target_; |
93 int active_touches_; | 70 int active_touches_; |
94 std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash> | |
95 hittest_data_; | |
96 | 71 |
97 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); | 72 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter); |
98 }; | 73 }; |
99 | 74 |
100 } // namespace content | 75 } // namespace content |
101 | 76 |
102 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_INPUT_EVENT_ROUTER_H
_ |
OLD | NEW |