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

Side by Side Diff: ui/snapshot/snapshot.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, 10 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
« no previous file with comments | « ui/snapshot/snapshot.h ('k') | ui/snapshot/snapshot_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
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(
36 window, source_rect,
37 base::Bind(EncodeImageAndSchedulePNGCallback,
38 std::move(background_task_runner), callback));
39 }
40
41 } // namespace ui
OLDNEW
« no previous file with comments | « ui/snapshot/snapshot.h ('k') | ui/snapshot/snapshot_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698