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

Side by Side Diff: content/public/browser/render_widget_host.h

Issue 12090109: Tab Capture: Backing store readbacks to YV12 VideoFrames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trim some trailing whitespace. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/browser/keyboard_listener.h" 10 #include "content/public/browser/keyboard_listener.h"
(...skipping 10 matching lines...) Expand all
21 #elif defined(OS_MACOSX) 21 #elif defined(OS_MACOSX)
22 #include "skia/ext/platform_device.h" 22 #include "skia/ext/platform_device.h"
23 #endif 23 #endif
24 24
25 class SkBitmap; 25 class SkBitmap;
26 26
27 namespace gfx { 27 namespace gfx {
28 class Rect; 28 class Rect;
29 } 29 }
30 30
31 namespace media {
32 class VideoFrame;
33 }
34
31 namespace content { 35 namespace content {
32 36
33 class RenderProcessHost; 37 class RenderProcessHost;
34 class RenderWidgetHostImpl; 38 class RenderWidgetHostImpl;
35 class RenderWidgetHostView; 39 class RenderWidgetHostView;
36 40
37 // A RenderWidgetHost manages the browser side of a browser<->renderer 41 // A RenderWidgetHost manages the browser side of a browser<->renderer
38 // HWND connection. The HWND lives in the browser process, and 42 // HWND connection. The HWND lives in the browser process, and
39 // windows events are sent over IPC to the corresponding object in the 43 // windows events are sent over IPC to the corresponding object in the
40 // renderer. The renderer paints into shared memory, which we 44 // renderer. The renderer paints into shared memory, which we
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 165
162 virtual void Focus() = 0; 166 virtual void Focus() = 0;
163 virtual void Blur() = 0; 167 virtual void Blur() = 0;
164 168
165 // Sets whether the renderer should show controls in an active state. On all 169 // Sets whether the renderer should show controls in an active state. On all
166 // platforms except mac, that's the same as focused. On mac, the frontmost 170 // platforms except mac, that's the same as focused. On mac, the frontmost
167 // window will show active controls even if the focus is not in the web 171 // window will show active controls even if the focus is not in the web
168 // contents, but e.g. in the omnibox. 172 // contents, but e.g. in the omnibox.
169 virtual void SetActive(bool active) = 0; 173 virtual void SetActive(bool active) = 0;
170 174
171 // Copies the given subset of the backing store, and passes the result as a 175 // Copies the given subset of the backing store, and passes the result as an
172 // bitmap to a callback. 176 // ARGB bitmap to a callback.
173 // 177 //
174 // If |src_rect| is empty, the whole contents is copied. If non empty 178 // If |src_rect| is empty, the whole contents is copied. If non empty
175 // |accelerated_dst_size| is given and accelerated compositing is active, the 179 // |accelerated_dst_size| is given and accelerated compositing is active, the
176 // content is shrunk so that it fits in |accelerated_dst_size|. If 180 // content is shrunk so that it fits in |accelerated_dst_size|. If
177 // |accelerated_dst_size| is larger than the content size, the content is not 181 // |accelerated_dst_size| is larger than the content size, the content is not
178 // resized. If |accelerated_dst_size| is empty, the size copied from the 182 // resized. If |accelerated_dst_size| is empty, the size copied from the
179 // source contents is used. |callback| is invoked with true on success, false 183 // source contents is used. |callback| is invoked with true on success, false
180 // otherwise, along with a SkBitmap containing the copied pixel data. 184 // otherwise, along with a SkBitmap containing the copied pixel data.
181 // 185 //
182 // NOTE: |callback| is called synchronously if the backing store is available. 186 // NOTE: |callback| is called synchronously if the backing store is available.
183 // When accelerated compositing is active, |callback| may be called 187 // When accelerated compositing is active, |callback| may be called
184 // asynchronously. 188 // asynchronously.
185 virtual void CopyFromBackingStore( 189 virtual void CopyFromBackingStore(
186 const gfx::Rect& src_rect, 190 const gfx::Rect& src_rect,
187 const gfx::Size& accelerated_dst_size, 191 const gfx::Size& accelerated_dst_size,
188 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; 192 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0;
189 #if defined(TOOLKIT_GTK) 193 #if defined(TOOLKIT_GTK)
190 // Paint the backing store into the target's |dest_rect|. 194 // Paint the backing store into the target's |dest_rect|.
191 virtual bool CopyFromBackingStoreToGtkWindow(const gfx::Rect& dest_rect, 195 virtual bool CopyFromBackingStoreToGtkWindow(const gfx::Rect& dest_rect,
192 GdkWindow* target) = 0; 196 GdkWindow* target) = 0;
193 #elif defined(OS_MACOSX) 197 #elif defined(OS_MACOSX)
194 virtual gfx::Size GetBackingStoreSize() = 0; 198 virtual gfx::Size GetBackingStoreSize() = 0;
195 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect, 199 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect,
196 CGContextRef target) = 0; 200 CGContextRef target) = 0;
197 #endif 201 #endif
202 // Returns true if CopyFromBackingStoreToVideoFrame is possible on the current
scherkus (not reviewing) 2013/02/05 22:40:44 nit: add () to function names referenced in commen
ncarter (slow) 2013/02/06 23:54:44 Done.
203 // backing store. Depends on platform support and compositor state. Callers
204 // should check this before each call to CopyFromBackingStoreToVideoFrame().
scherkus (not reviewing) 2013/02/05 22:40:44 can we promote this "should" into a "must" and hav
ncarter (slow) 2013/02/06 23:54:44 Thanks for sharing your experience (which sounds h
scherkus (not reviewing) 2013/02/07 18:25:03 SGTM
205 virtual bool CanCopyToVideoFrame() const = 0;
206 // Copies a given subset of the backing store into a YV12 VideoFrame, and pass
scherkus (not reviewing) 2013/02/05 22:40:44 nit: blank line before comments to avoid walloftex
ncarter (slow) 2013/02/06 23:54:44 Done.
207 // it to the callback. The resulting VideoFrame will always be exactly
208 // |dst_size|. If |src_rect| does not match |dst_size|, the copied content
209 // will be scaled and letterboxed with black borders. Callbacks are permitted
210 // to take a refcount on the resulting VideoFrame for further processing on
211 // other threads.
212 //
213 // CopyFromBackingStoreToVideoFrame is not always possible. Callers should
214 // check the return value of CanCopyToVideoFrame(), and if false, fall back to
215 // a different method such as CopyFromBackingStore.
216 virtual void CopyFromBackingStoreToVideoFrame(
217 const gfx::Rect& src_rect,
218 const gfx::Size& dst_size,
219 const base::Callback<void(media::VideoFrame*)>& callback) = 0;
198 220
199 // Send a command to the renderer to turn on full accessibility. 221 // Send a command to the renderer to turn on full accessibility.
200 virtual void EnableFullAccessibilityMode() = 0; 222 virtual void EnableFullAccessibilityMode() = 0;
201 223
202 // Forwards the given message to the renderer. These are called by 224 // Forwards the given message to the renderer. These are called by
203 // the view when it has received a message. 225 // the view when it has received a message.
204 virtual void ForwardMouseEvent( 226 virtual void ForwardMouseEvent(
205 const WebKit::WebMouseEvent& mouse_event) = 0; 227 const WebKit::WebMouseEvent& mouse_event) = 0;
206 virtual void ForwardWheelEvent( 228 virtual void ForwardWheelEvent(
207 const WebKit::WebMouseWheelEvent& wheel_event) = 0; 229 const WebKit::WebMouseWheelEvent& wheel_event) = 0;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // within content/. This method is necessary because 302 // within content/. This method is necessary because
281 // RenderWidgetHost is the root of a diamond inheritance pattern, so 303 // RenderWidgetHost is the root of a diamond inheritance pattern, so
282 // subclasses inherit it virtually, which removes our ability to 304 // subclasses inherit it virtually, which removes our ability to
283 // static_cast to the subclass. 305 // static_cast to the subclass.
284 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; 306 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0;
285 }; 307 };
286 308
287 } // namespace content 309 } // namespace content
288 310
289 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ 311 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698