void OnCapturePageDone(
v8::Isolate* isolate,
const base::Callback<void(const gfx::Image&)>& callback,
- const std::vector<unsigned char>& data) {
+ const SkBitmap& bitmap) {
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
- callback.Run(gfx::Image::CreateFrom1xPNGBytes(&data.front(), data.size()));
+ callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
}
} // namespace
RenderWidgetHostView* const view = contents->GetRenderWidgetHostView();
RenderWidgetHost* const host = view ? view->GetRenderWidgetHost() : nullptr;
if (!view || !host) {
- callback.Run(std::vector<unsigned char>());
+ callback.Run(SkBitmap());
return;
}
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
const SkBitmap& bitmap,
content::ReadbackResponse response) {
- SkAutoLockPixels screen_capture_lock(bitmap);
- std::vector<unsigned char> data;
- if (response == content::READBACK_SUCCESS)
- gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &data);
- callback.Run(data);
+ callback.Run(bitmap);
}
void NativeWindow::CallDevToolsFunction(const std::string& function_name,
public content::WebContentsObserver,
public content::NotificationObserver {
public:
- typedef base::Callback<void(const std::vector<unsigned char>& buffer)>
- CapturePageCallback;
+ typedef base::Callback<void(const SkBitmap& bitmap)> CapturePageCallback;
class DialogScope {
public: