Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: ui/snapshot/screenshot_grabber.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Disabled test on MacOS >=10.11, added ref to bug. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/snapshot/screenshot_grabber.h ('k') | ui/snapshot/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/snapshot/screenshot_grabber.cc
diff --git a/ui/snapshot/screenshot_grabber.cc b/ui/snapshot/screenshot_grabber.cc
index 02e91df313d20d67b9dc3cad3979f9f20949d7b8..da79cb28737e6278252c412fe1c2707ec235ebc0 100644
--- a/ui/snapshot/screenshot_grabber.cc
+++ b/ui/snapshot/screenshot_grabber.cc
@@ -43,7 +43,7 @@ using ShowNotificationCallback =
void SaveScreenshot(scoped_refptr<base::TaskRunner> ui_task_runner,
const ShowNotificationCallback& callback,
const base::FilePath& screenshot_path,
- scoped_refptr<base::RefCountedBytes> png_data,
+ scoped_refptr<base::RefCountedMemory> png_data,
ScreenshotGrabberDelegate::FileResult result,
const base::FilePath& local_path) {
DCHECK(!base::MessageLoopForUI::IsCurrent());
@@ -57,7 +57,7 @@ void SaveScreenshot(scoped_refptr<base::TaskRunner> ui_task_runner,
// Successfully got a local file to write to, write png data.
DCHECK_GT(static_cast<int>(png_data->size()), 0);
if (static_cast<size_t>(base::WriteFile(
- local_path, reinterpret_cast<char*>(&(png_data->data()[0])),
+ local_path, reinterpret_cast<const char*>(png_data->front()),
static_cast<int>(png_data->size()))) != png_data->size()) {
LOG(ERROR) << "Failed to save to " << local_path.value();
screenshot_result =
@@ -168,7 +168,7 @@ void ScreenshotGrabber::TakeScreenshot(gfx::NativeWindow window,
cursor_hider_ = ScopedCursorHider::Create(aura_window->GetRootWindow());
#endif
- ui::GrabWindowSnapshotAsync(
+ ui::GrabWindowSnapshotAsyncPNG(
window, rect, blocking_task_runner_,
base::Bind(&ScreenshotGrabber::GrabWindowSnapshotAsyncCallback,
factory_.GetWeakPtr(), window_identifier, screenshot_path,
@@ -209,7 +209,7 @@ void ScreenshotGrabber::GrabWindowSnapshotAsyncCallback(
const std::string& window_identifier,
base::FilePath screenshot_path,
bool is_partial,
- scoped_refptr<base::RefCountedBytes> png_data) {
+ scoped_refptr<base::RefCountedMemory> png_data) {
DCHECK(base::MessageLoopForUI::IsCurrent());
if (!png_data.get()) {
if (is_partial) {
« no previous file with comments | « ui/snapshot/screenshot_grabber.h ('k') | ui/snapshot/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698