Move capturePage to WebContents

This commit is contained in:
Kevin Sawicki 2016-07-05 15:43:57 -07:00
parent d42d10a47c
commit f7b72f0948
8 changed files with 67 additions and 79 deletions

View file

@ -54,6 +54,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
using PrintToPDFCallback =
base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>;
using CapturePageCallback = base::Callback<void(const SkBitmap& bitmap)>;
// Create from an existing WebContents.
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents);
@ -145,6 +147,10 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Dragging native items.
void StartDrag(const mate::Dictionary& item, mate::Arguments* args);
// Captures the page with |rect|, |callback| would be called when capturing is
// done.
void CapturePage(mate::Arguments* args);
// Methods for creating <webview>.
void SetSize(const SetSizeParams& params);
bool IsGuest() const;
@ -159,6 +165,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
const std::string& frame_name,
WindowOpenDisposition disposition);
// Called when CapturePage is done.
void OnCapturePageDone(base::Callback<void(const gfx::Image&)>,
const SkBitmap& bitmap,
content::ReadbackResponse response);
// Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);