Make OnCapturePageDone static
This commit is contained in:
parent
c2ecc49be2
commit
b900ff93e4
2 changed files with 8 additions and 17 deletions
|
@ -239,6 +239,13 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||||
return storage_partition->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
|
} // namespace
|
||||||
|
|
||||||
WebContents::WebContents(v8::Isolate* isolate,
|
WebContents::WebContents(v8::Isolate* isolate,
|
||||||
|
@ -1272,21 +1279,10 @@ void WebContents::CapturePage(mate::Arguments* args) {
|
||||||
host->CopyFromBackingStore(
|
host->CopyFromBackingStore(
|
||||||
gfx::Rect(rect.origin(), view_size),
|
gfx::Rect(rect.origin(), view_size),
|
||||||
bitmap_size,
|
bitmap_size,
|
||||||
base::Bind(&WebContents::OnCapturePageDone,
|
base::Bind(&OnCapturePageDone, callback),
|
||||||
base::Unretained(this),
|
|
||||||
callback),
|
|
||||||
kBGRA_8888_SkColorType);
|
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) {
|
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
||||||
content::WebCursor::CursorInfo info;
|
content::WebCursor::CursorInfo info;
|
||||||
cursor.GetCursorInfo(&info);
|
cursor.GetCursorInfo(&info);
|
||||||
|
|
|
@ -163,11 +163,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
const std::string& frame_name,
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition);
|
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.
|
// Returns the web preferences of current WebContents.
|
||||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue