Make OnCapturePageDone static

This commit is contained in:
Kevin Sawicki 2016-07-06 09:32:58 -07:00
parent c2ecc49be2
commit b900ff93e4
2 changed files with 8 additions and 17 deletions

View file

@ -239,6 +239,13 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
return storage_partition->GetServiceWorkerContext();
}
// Called when CapturePage is done.
void OnCapturePageDone(base::Callback<void(const gfx::Image&)> callback,
const SkBitmap& bitmap,
content::ReadbackResponse response) {
callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
}
} // namespace
WebContents::WebContents(v8::Isolate* isolate,
@ -1272,21 +1279,10 @@ void WebContents::CapturePage(mate::Arguments* args) {
host->CopyFromBackingStore(
gfx::Rect(rect.origin(), view_size),
bitmap_size,
base::Bind(&WebContents::OnCapturePageDone,
base::Unretained(this),
callback),
base::Bind(&OnCapturePageDone, callback),
kBGRA_8888_SkColorType);
}
void WebContents::OnCapturePageDone(
base::Callback<void(const gfx::Image&)> callback,
const SkBitmap& bitmap,
content::ReadbackResponse response) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
content::WebCursor::CursorInfo info;
cursor.GetCursorInfo(&info);

View file

@ -163,11 +163,6 @@ 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);