OLD | NEW |
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/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Grabs snapshot from renderer side and returns the bitmap to a callback. | 287 // Grabs snapshot from renderer side and returns the bitmap to a callback. |
288 // If |src_rect| is empty, the whole contents is copied. This is an expensive | 288 // If |src_rect| is empty, the whole contents is copied. This is an expensive |
289 // operation due to the IPC, but it can be used as a fallback method when | 289 // operation due to the IPC, but it can be used as a fallback method when |
290 // CopyFromBackingStore fails due to the backing store not being available or, | 290 // CopyFromBackingStore fails due to the backing store not being available or, |
291 // in composited mode, when the accelerated surface is not available to the | 291 // in composited mode, when the accelerated surface is not available to the |
292 // browser side. | 292 // browser side. |
293 virtual void GetSnapshotFromRenderer( | 293 virtual void GetSnapshotFromRenderer( |
294 const gfx::Rect& src_subrect, | 294 const gfx::Rect& src_subrect, |
295 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; | 295 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; |
296 | 296 |
| 297 // Forces redraw in the renderer and when the update reaches the browser |
| 298 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. |
| 299 virtual void GetSnapshotFromBrowser( |
| 300 const base::Callback<void(const unsigned char*, size_t)> callback) = 0; |
| 301 |
297 protected: | 302 protected: |
298 friend class RenderWidgetHostImpl; | 303 friend class RenderWidgetHostImpl; |
299 | 304 |
300 // Retrieves the implementation class. Intended only for code | 305 // Retrieves the implementation class. Intended only for code |
301 // within content/. This method is necessary because | 306 // within content/. This method is necessary because |
302 // RenderWidgetHost is the root of a diamond inheritance pattern, so | 307 // RenderWidgetHost is the root of a diamond inheritance pattern, so |
303 // subclasses inherit it virtually, which removes our ability to | 308 // subclasses inherit it virtually, which removes our ability to |
304 // static_cast to the subclass. | 309 // static_cast to the subclass. |
305 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; | 310 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; |
306 }; | 311 }; |
307 | 312 |
308 } // namespace content | 313 } // namespace content |
309 | 314 |
310 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 315 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
OLD | NEW |