| Index: content/browser/devtools/protocol/page_handler.cc
|
| diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc
|
| index c31a27ecd24d5e9ce7fe1173af498aea53808243..fb9e7eac9af736e1126220800c543c097d448169 100644
|
| --- a/content/browser/devtools/protocol/page_handler.cc
|
| +++ b/content/browser/devtools/protocol/page_handler.cc
|
| @@ -4,7 +4,11 @@
|
|
|
| #include "content/browser/devtools/protocol/page_handler.h"
|
|
|
| +#include <algorithm>
|
| +#include <memory>
|
| #include <string>
|
| +#include <utility>
|
| +#include <vector>
|
|
|
| #include "base/base64.h"
|
| #include "base/bind.h"
|
| @@ -284,6 +288,7 @@ Response PageHandler::NavigateToHistoryEntry(int entry_id) {
|
| void PageHandler::CaptureScreenshot(
|
| Maybe<std::string> format,
|
| Maybe<int> quality,
|
| + Maybe<bool> from_surface,
|
| std::unique_ptr<CaptureScreenshotCallback> callback) {
|
| if (!host_ || !host_->GetRenderWidgetHost()) {
|
| callback->sendFailure(Response::InternalError());
|
| @@ -292,7 +297,15 @@ void PageHandler::CaptureScreenshot(
|
|
|
| std::string screenshot_format = format.fromMaybe(kPng);
|
| int screenshot_quality = quality.fromMaybe(kDefaultScreenshotQuality);
|
| + bool screenshot_from_surface = from_surface.fromMaybe(false);
|
|
|
| + if (screenshot_from_surface) {
|
| + host_->GetRenderWidgetHost()->GetSurfaceSnapshotFromBrowser(
|
| + base::Bind(&PageHandler::ScreenshotCaptured, weak_factory_.GetWeakPtr(),
|
| + base::Passed(std::move(callback)), screenshot_format,
|
| + screenshot_quality));
|
| + return;
|
| + }
|
| host_->GetRenderWidgetHost()->GetSnapshotFromBrowser(
|
| base::Bind(&PageHandler::ScreenshotCaptured, weak_factory_.GetWeakPtr(),
|
| base::Passed(std::move(callback)), screenshot_format,
|
|
|