OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <memory> | 12 #include <memory> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "cc/resources/returned_resource.h" | 19 #include "cc/resources/returned_resource.h" |
20 #include "cc/scheduler/begin_frame_source.h" | 20 #include "cc/scheduler/begin_frame_source.h" |
21 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 21 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
22 #include "cc/surfaces/surface_info.h" | 22 #include "cc/surfaces/surface_info.h" |
23 #include "cc/surfaces/surface_sequence.h" | 23 #include "cc/surfaces/surface_sequence.h" |
24 #include "content/browser/compositor/image_transport_factory.h" | 24 #include "content/browser/compositor/image_transport_factory.h" |
25 #include "content/browser/renderer_host/event_with_latency_info.h" | 25 #include "content/browser/renderer_host/event_with_latency_info.h" |
26 #include "content/browser/renderer_host/input/touch_selection_controller_client_ manager.h" | |
26 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 27 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
27 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
28 #include "content/common/input/input_event_ack_state.h" | 29 #include "content/common/input/input_event_ack_state.h" |
29 #include "content/public/browser/readback_types.h" | 30 #include "content/public/browser/readback_types.h" |
30 #include "ui/gfx/geometry/rect.h" | 31 #include "ui/gfx/geometry/rect.h" |
31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
32 | 33 |
33 namespace cc { | 34 namespace cc { |
34 class CompositorFrameSinkSupport; | 35 class CompositorFrameSinkSupport; |
35 } | 36 } |
36 | 37 |
37 namespace content { | 38 namespace content { |
38 class CrossProcessFrameConnector; | 39 class CrossProcessFrameConnector; |
39 class RenderWidgetHost; | 40 class RenderWidgetHost; |
40 class RenderWidgetHostImpl; | 41 class RenderWidgetHostImpl; |
41 class RenderWidgetHostViewChildFrameTest; | 42 class RenderWidgetHostViewChildFrameTest; |
42 class RenderWidgetHostViewGuestSurfaceTest; | 43 class RenderWidgetHostViewGuestSurfaceTest; |
44 class TouchSelectionControllerClientChildFrame; | |
43 | 45 |
44 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost | 46 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost |
45 // associated with content being rendered in a separate process from | 47 // associated with content being rendered in a separate process from |
46 // content that is embedding it. This is not a platform-specific class; rather, | 48 // content that is embedding it. This is not a platform-specific class; rather, |
47 // the embedding renderer process implements the platform containing the | 49 // the embedding renderer process implements the platform containing the |
48 // widget, and the top-level frame's RenderWidgetHostView will ultimately | 50 // widget, and the top-level frame's RenderWidgetHostView will ultimately |
49 // manage all native widget interaction. | 51 // manage all native widget interaction. |
50 // | 52 // |
51 // See comments in render_widget_host_view.h about this class and its members. | 53 // See comments in render_widget_host_view.h about this class and its members. |
52 class CONTENT_EXPORT RenderWidgetHostViewChildFrame | 54 class CONTENT_EXPORT RenderWidgetHostViewChildFrame |
53 : public RenderWidgetHostViewBase, | 55 : public RenderWidgetHostViewBase, |
56 public TouchSelectionControllerClientManager::Observer, | |
54 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient) { | 57 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient) { |
55 public: | 58 public: |
56 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget); | 59 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget); |
57 ~RenderWidgetHostViewChildFrame() override; | 60 ~RenderWidgetHostViewChildFrame() override; |
58 | 61 |
59 void SetCrossProcessFrameConnector( | 62 void SetCrossProcessFrameConnector( |
60 CrossProcessFrameConnector* frame_connector); | 63 CrossProcessFrameConnector* frame_connector); |
61 | 64 |
62 // This functions registers single-use callbacks that want to be notified when | 65 // This functions registers single-use callbacks that want to be notified when |
63 // the next frame is swapped. The callback is triggered by | 66 // the next frame is swapped. The callback is triggered by |
64 // ProcessCompositorFrame, which is the appropriate time to request pixel | 67 // ProcessCompositorFrame, which is the appropriate time to request pixel |
65 // readback for the frame that is about to be drawn. Once called, the callback | 68 // readback for the frame that is about to be drawn. Once called, the callback |
66 // pointer is released. | 69 // pointer is released. |
67 // TODO(wjmaclean): We should consider making this available in other view | 70 // TODO(wjmaclean): We should consider making this available in other view |
68 // types, such as RenderWidgetHostViewAura. | 71 // types, such as RenderWidgetHostViewAura. |
69 void RegisterFrameSwappedCallback(std::unique_ptr<base::Closure> callback); | 72 void RegisterFrameSwappedCallback(std::unique_ptr<base::Closure> callback); |
70 | 73 |
74 // TouchSelectionControllerClientManager::Observer implementation. | |
75 void OnManagerWillDestroy( | |
76 TouchSelectionControllerClientManager* manager) override; | |
77 | |
71 // RenderWidgetHostView implementation. | 78 // RenderWidgetHostView implementation. |
72 void InitAsChild(gfx::NativeView parent_view) override; | 79 void InitAsChild(gfx::NativeView parent_view) override; |
73 RenderWidgetHost* GetRenderWidgetHost() const override; | 80 RenderWidgetHost* GetRenderWidgetHost() const override; |
74 void SetSize(const gfx::Size& size) override; | 81 void SetSize(const gfx::Size& size) override; |
75 void SetBounds(const gfx::Rect& rect) override; | 82 void SetBounds(const gfx::Rect& rect) override; |
76 void Focus() override; | 83 void Focus() override; |
77 bool HasFocus() const override; | 84 bool HasFocus() const override; |
78 bool IsSurfaceAvailableForCopy() const override; | 85 bool IsSurfaceAvailableForCopy() const override; |
79 void CopyFromSurface(const gfx::Rect& src_rect, | 86 void CopyFromSurface(const gfx::Rect& src_rect, |
80 const gfx::Size& output_size, | 87 const gfx::Size& output_size, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 // to the frame tree. | 189 // to the frame tree. |
183 RenderWidgetHostViewBase* GetParentView(); | 190 RenderWidgetHostViewBase* GetParentView(); |
184 | 191 |
185 void RegisterFrameSinkId(); | 192 void RegisterFrameSinkId(); |
186 void UnregisterFrameSinkId(); | 193 void UnregisterFrameSinkId(); |
187 | 194 |
188 void UpdateViewportIntersection(const gfx::Rect& viewport_intersection); | 195 void UpdateViewportIntersection(const gfx::Rect& viewport_intersection); |
189 | 196 |
190 bool has_frame() { return has_frame_; } | 197 bool has_frame() { return has_frame_; } |
191 | 198 |
199 ui::TextInputType GetTextInputType() const; | |
200 bool GetSelectionRange(gfx::Range* range) const; | |
201 gfx::Point GetViewOriginInRoot() const; | |
kenrb
2017/05/23 16:19:02
This one warrants a comment explaining what it ret
wjmaclean
2017/05/23 17:00:41
Done.
| |
202 | |
192 protected: | 203 protected: |
193 friend class RenderWidgetHostView; | 204 friend class RenderWidgetHostView; |
194 friend class RenderWidgetHostViewChildFrameTest; | 205 friend class RenderWidgetHostViewChildFrameTest; |
195 friend class RenderWidgetHostViewGuestSurfaceTest; | 206 friend class RenderWidgetHostViewGuestSurfaceTest; |
196 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest, | 207 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest, |
197 ForwardsBeginFrameAcks); | 208 ForwardsBeginFrameAcks); |
198 | 209 |
199 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); | 210 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); |
200 void Init(); | 211 void Init(); |
201 | 212 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 // The surface client ID of the parent RenderWidgetHostView. 0 if none. | 269 // The surface client ID of the parent RenderWidgetHostView. 0 if none. |
259 cc::FrameSinkId parent_frame_sink_id_; | 270 cc::FrameSinkId parent_frame_sink_id_; |
260 | 271 |
261 bool has_frame_ = false; | 272 bool has_frame_ = false; |
262 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = | 273 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = |
263 nullptr; | 274 nullptr; |
264 | 275 |
265 // The background color of the widget. | 276 // The background color of the widget. |
266 SkColor background_color_; | 277 SkColor background_color_; |
267 | 278 |
279 std::unique_ptr<TouchSelectionControllerClientChildFrame> | |
280 selection_controller_client_; | |
281 | |
268 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; | 282 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; |
269 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); | 283 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); |
270 }; | 284 }; |
271 | 285 |
272 } // namespace content | 286 } // namespace content |
273 | 287 |
274 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 288 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
OLD | NEW |