Return NativeImage in BrowserWindow.capturePage
This commit is contained in:
parent
443a4b8f2f
commit
da407200d2
2 changed files with 4 additions and 8 deletions
|
@ -52,15 +52,11 @@ namespace {
|
||||||
|
|
||||||
void OnCapturePageDone(
|
void OnCapturePageDone(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const base::Callback<void(v8::Handle<v8::Value>)>& callback,
|
const base::Callback<void(const gfx::Image&)>& callback,
|
||||||
const std::vector<unsigned char>& data) {
|
const std::vector<unsigned char>& data) {
|
||||||
v8::Locker locker(isolate);
|
v8::Locker locker(isolate);
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
callback.Run(gfx::Image::CreateFrom1xPNGBytes(&data.front(), data.size()));
|
||||||
v8::Local<v8::Value> buffer = node::Buffer::New(
|
|
||||||
reinterpret_cast<const char*>(data.data()),
|
|
||||||
data.size());
|
|
||||||
callback.Run(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -374,7 +370,7 @@ bool Window::IsDocumentEdited() {
|
||||||
|
|
||||||
void Window::CapturePage(mate::Arguments* args) {
|
void Window::CapturePage(mate::Arguments* args) {
|
||||||
gfx::Rect rect;
|
gfx::Rect rect;
|
||||||
base::Callback<void(v8::Handle<v8::Value>)> callback;
|
base::Callback<void(const gfx::Image&)> callback;
|
||||||
|
|
||||||
if (!(args->Length() == 1 && args->GetNext(&callback)) &&
|
if (!(args->Length() == 1 && args->GetNext(&callback)) &&
|
||||||
!(args->Length() == 2 && args->GetNext(&rect)
|
!(args->Length() == 2 && args->GetNext(&rect)
|
||||||
|
|
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 3387f33a8e7b4107f4268dec2a72a3fa943d706c
|
Subproject commit 8d537ee2b6da29c1aa38928590d4c56700e1c69b
|
Loading…
Add table
Add a link
Reference in a new issue