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

Side by Side Diff: ui/snapshot/snapshot.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Wait for load in CaptureScreenshotTest to fix android bot. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
Avi (use Gerrit) 2017/01/09 16:57:33 It's 2017.
Eric Seckler 2017/01/11 15:58:44 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/snapshot/snapshot.h"
6
7 #include "base/bind.h"
8 #include "base/callback.h"
9 #include "base/task_runner_util.h"
10 #include "ui/gfx/image/image.h"
11
12 namespace ui {
13
14 namespace {
15
16 scoped_refptr<base::RefCountedMemory> EncodeImage(const gfx::Image& image) {
17 return image.As1xPNGBytes();
18 }
19
20 void EncodeImageAndSchedulePNGCallback(
21 scoped_refptr<base::TaskRunner> background_task_runner,
22 const GrabWindowSnapshotAsyncPNGCallback& callback,
23 const gfx::Image& image) {
24 base::PostTaskAndReplyWithResult(background_task_runner.get(), FROM_HERE,
25 base::Bind(EncodeImage, image), callback);
26 }
27
28 } // namespace
29
30 void GrabWindowSnapshotAsyncPNG(
31 gfx::NativeWindow window,
32 const gfx::Rect& source_rect,
33 scoped_refptr<base::TaskRunner> background_task_runner,
34 const GrabWindowSnapshotAsyncPNGCallback& callback) {
35 GrabWindowSnapshotAsync(window, source_rect,
36 base::Bind(EncodeImageAndSchedulePNGCallback,
37 background_task_runner, callback));
sadrul 2017/01/10 05:12:49 std::move(background_task_runner)
Eric Seckler 2017/01/11 15:58:44 Done.
38 }
39
40 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698