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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.h

Issue 2732923002: Add fromSurface optional parameter to devtools Page.CaptureScreenshot (Closed)
Patch Set: nits Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.h
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index c60dc6201ba8f2343e85d25b4568ee82d2df07ec..3ea9441944892a35986e8fded6575d75d4d05068 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -49,6 +49,7 @@
#include "ui/events/latency_info.h"
#include "ui/gfx/native_widget_types.h"
+class SkBitmap;
struct FrameHostMsg_HittestData_Params;
struct ViewHostMsg_SelectionBounds_Params;
struct ViewHostMsg_UpdateRect_Params;
@@ -200,14 +201,19 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
// Notification that the screen info has changed.
void NotifyScreenInfoChanged();
- // Forces redraw in the renderer and when the update reaches the browser
- // grabs snapshot from the compositor. On MacOS, the snapshot is taken from
- // the Cocoa view for end-to-end testing purposes. Returns a gfx::Image that
- // is backed by an NSImage on MacOS or by an SkBitmap otherwise. The
- // gfx::Image may be empty if the snapshot failed.
+ // Forces redraw in the renderer and when the update reaches the browser.
+ // grabs snapshot from the compositor.
+ // If |from_surface| is false, it will obtain the snapshot directly from the
+ // view (On MacOS, the snapshot is taken from the Cocoa view for end-to-end
+ // testing purposes).
+ // Otherwise, the snapshot is obtained from the view's surface, with no bounds
+ // defined.
+ // Returns a gfx::Image that is backed by an NSImage on MacOS or by an
+ // SkBitmap otherwise. The gfx::Image may be empty if the snapshot failed.
using GetSnapshotFromBrowserCallback =
base::Callback<void(const gfx::Image&)>;
- void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback);
+ void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback,
+ bool from_surface);
const NativeWebKeyboardEvent* GetLastKeyboardEvent() const;
@@ -694,6 +700,11 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
void WindowSnapshotReachedScreen(int snapshot_id);
+ void OnSnapshotFromSurfaceReceived(int snapshot_id,
+ int retry_count,
+ const SkBitmap& bitmap,
+ ReadbackResponse response);
+
void OnSnapshotReceived(int snapshot_id, const gfx::Image& image);
// 1. Grants permissions to URL (if any)
@@ -857,6 +868,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
int next_browser_snapshot_id_;
using PendingSnapshotMap = std::map<int, GetSnapshotFromBrowserCallback>;
PendingSnapshotMap pending_browser_snapshots_;
+ PendingSnapshotMap pending_surface_browser_snapshots_;
// Indicates whether a RenderFramehost has ownership, in which case this
// object does not self destroy.
« no previous file with comments | « content/browser/devtools/protocol/page_handler.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698