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

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

Issue 1635513003: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove WaitForFirstFrame() from browser_test_utils (cleanup). Created 4 years, 10 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 <vector> 12 #include <vector>
12 13
14 #include "base/callback.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
15 #include "build/build_config.h" 17 #include "build/build_config.h"
16 #include "cc/resources/returned_resource.h" 18 #include "cc/resources/returned_resource.h"
17 #include "cc/surfaces/surface_factory_client.h" 19 #include "cc/surfaces/surface_factory_client.h"
18 #include "cc/surfaces/surface_id_allocator.h" 20 #include "cc/surfaces/surface_id_allocator.h"
19 #include "content/browser/compositor/image_transport_factory.h" 21 #include "content/browser/compositor/image_transport_factory.h"
20 #include "content/browser/renderer_host/render_widget_host_view_base.h" 22 #include "content/browser/renderer_host/render_widget_host_view_base.h"
21 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
22 #include "content/public/browser/readback_types.h" 24 #include "content/public/browser/readback_types.h"
(...skipping 28 matching lines...) Expand all
51 public cc::SurfaceFactoryClient { 53 public cc::SurfaceFactoryClient {
52 public: 54 public:
53 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); 55 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
54 ~RenderWidgetHostViewChildFrame() override; 56 ~RenderWidgetHostViewChildFrame() override;
55 57
56 void set_cross_process_frame_connector( 58 void set_cross_process_frame_connector(
57 CrossProcessFrameConnector* frame_connector) { 59 CrossProcessFrameConnector* frame_connector) {
58 frame_connector_ = frame_connector; 60 frame_connector_ = frame_connector;
59 } 61 }
60 62
63 // This functions registers single-use callbacks that want to be notified when
64 // the next frame is drawn. Once called, the callback pointer is released.
65 // TODO(wjmaclean): We should consider making this available in other view
66 // types, such as RenderWidgetHostViewAura.
ncarter (slow) 2016/01/27 21:08:25 This seems fairly similar in purpose to RenderWidg
wjmaclean 2016/01/27 21:28:01 Are you suggesting we re-write RenderWidgetHostVie
ncarter (slow) 2016/01/28 20:49:58 My main intent was to call attention to the Render
miu 2016/02/04 20:19:11 Agreed. I have it on my roadmap this year to do s
67 void RegisterFrameDrawnCallback(scoped_ptr<base::Closure> callback);
ncarter (slow) 2016/01/27 21:08:25 In the webview case, is there really necessarily a
wjmaclean 2016/01/27 21:28:01 I'm not entirely sure, though I suspect the surfac
ncarter (slow) 2016/01/28 20:49:58 OK.
miu 2016/02/04 20:19:10 My understanding here is that the Compositor will
68
61 // RenderWidgetHostView implementation. 69 // RenderWidgetHostView implementation.
62 void InitAsChild(gfx::NativeView parent_view) override; 70 void InitAsChild(gfx::NativeView parent_view) override;
63 RenderWidgetHost* GetRenderWidgetHost() const override; 71 RenderWidgetHost* GetRenderWidgetHost() const override;
64 void SetSize(const gfx::Size& size) override; 72 void SetSize(const gfx::Size& size) override;
65 void SetBounds(const gfx::Rect& rect) override; 73 void SetBounds(const gfx::Rect& rect) override;
66 void Focus() override; 74 void Focus() override;
67 bool HasFocus() const override; 75 bool HasFocus() const override;
68 bool IsSurfaceAvailableForCopy() const override; 76 bool IsSurfaceAvailableForCopy() const override;
69 void Show() override; 77 void Show() override;
70 void Hide() override; 78 void Hide() override;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 207
200 // frame_connector_ provides a platform abstraction. Messages 208 // frame_connector_ provides a platform abstraction. Messages
201 // sent through it are routed to the embedding renderer process. 209 // sent through it are routed to the embedding renderer process.
202 CrossProcessFrameConnector* frame_connector_; 210 CrossProcessFrameConnector* frame_connector_;
203 211
204 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() { 212 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() {
205 return weak_factory_.GetWeakPtr(); 213 return weak_factory_.GetWeakPtr();
206 } 214 }
207 215
208 private: 216 private:
217 void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect,
218 const gfx::Size& dst_size,
219 const ReadbackRequestCallback& callback,
220 const SkColorType preferred_color_type);
221
222 using FrameDrawnCallbackList = std::deque<scoped_ptr<base::Closure>>;
223 // Since frame-drawn callbacks are "fire once", we use std::deque to make
224 // it convenient to swap() when processing the list.
225 FrameDrawnCallbackList frame_drawn_callbacks_;
209 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; 226 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_;
210 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); 227 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
211 }; 228 };
212 229
213 } // namespace content 230 } // namespace content
214 231
215 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 232 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698