Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.h

Issue 2883653002: Implement TouchSelectionEditing controls for OOPIF. (Closed)
Patch Set: ChildFrame client uses root view's animation defaults. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // to the frame tree. 191 // to the frame tree.
185 RenderWidgetHostViewBase* GetParentView(); 192 RenderWidgetHostViewBase* GetParentView();
186 193
187 void RegisterFrameSinkId(); 194 void RegisterFrameSinkId();
188 void UnregisterFrameSinkId(); 195 void UnregisterFrameSinkId();
189 196
190 void UpdateViewportIntersection(const gfx::Rect& viewport_intersection); 197 void UpdateViewportIntersection(const gfx::Rect& viewport_intersection);
191 198
192 bool has_frame() { return has_frame_; } 199 bool has_frame() { return has_frame_; }
193 200
201 ui::TextInputType GetTextInputType() const;
202 bool GetSelectionRange(gfx::Range* range) const;
203 // This returns the origin of this views's bounding rect in the coordinates
204 // of the root RenderWidgetHostView.
205 gfx::Point GetViewOriginInRoot() const;
206
194 protected: 207 protected:
195 friend class RenderWidgetHostView; 208 friend class RenderWidgetHostView;
196 friend class RenderWidgetHostViewChildFrameTest; 209 friend class RenderWidgetHostViewChildFrameTest;
197 friend class RenderWidgetHostViewGuestSurfaceTest; 210 friend class RenderWidgetHostViewGuestSurfaceTest;
198 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest, 211 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest,
199 ForwardsBeginFrameAcks); 212 ForwardsBeginFrameAcks);
200 213
201 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); 214 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
202 void Init(); 215 void Init();
203 216
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 const cc::SurfaceInfo& surface_info, 255 const cc::SurfaceInfo& surface_info,
243 const cc::SurfaceSequence& sequence); 256 const cc::SurfaceSequence& sequence);
244 257
245 void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect, 258 void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect,
246 const gfx::Size& dst_size, 259 const gfx::Size& dst_size,
247 const ReadbackRequestCallback& callback, 260 const ReadbackRequestCallback& callback,
248 const SkColorType preferred_color_type); 261 const SkColorType preferred_color_type);
249 262
250 void CreateCompositorFrameSinkSupport(); 263 void CreateCompositorFrameSinkSupport();
251 void ResetCompositorFrameSinkSupport(); 264 void ResetCompositorFrameSinkSupport();
265 void DetachFromTouchSelectionClientManagerIfNecessary();
252 266
253 virtual bool HasEmbedderChanged(); 267 virtual bool HasEmbedderChanged();
254 268
255 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>; 269 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>;
256 // Since frame-drawn callbacks are "fire once", we use std::deque to make 270 // Since frame-drawn callbacks are "fire once", we use std::deque to make
257 // it convenient to swap() when processing the list. 271 // it convenient to swap() when processing the list.
258 FrameSwappedCallbackList frame_swapped_callbacks_; 272 FrameSwappedCallbackList frame_swapped_callbacks_;
259 273
260 // The surface client ID of the parent RenderWidgetHostView. 0 if none. 274 // The surface client ID of the parent RenderWidgetHostView. 0 if none.
261 cc::FrameSinkId parent_frame_sink_id_; 275 cc::FrameSinkId parent_frame_sink_id_;
262 276
263 bool has_frame_ = false; 277 bool has_frame_ = false;
264 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = 278 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ =
265 nullptr; 279 nullptr;
266 280
267 // The background color of the widget. 281 // The background color of the widget.
268 SkColor background_color_; 282 SkColor background_color_;
269 283
284 std::unique_ptr<TouchSelectionControllerClientChildFrame>
285 selection_controller_client_;
286
270 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; 287 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_;
271 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); 288 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
272 }; 289 };
273 290
274 } // namespace content 291 } // namespace content
275 292
276 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 293 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698