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

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

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 unified diff | Download patch
« no previous file with comments | « ui/snapshot/screenshot_grabber.cc ('k') | ui/snapshot/snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_SNAPSHOT_SNAPSHOT_H_ 5 #ifndef UI_SNAPSHOT_SNAPSHOT_H_
6 #define UI_SNAPSHOT_SNAPSHOT_H_ 6 #define UI_SNAPSHOT_SNAPSHOT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace ui { 26 namespace ui {
27 27
28 // Grabs a snapshot of the window/view. No security checks are done. This is 28 // Grabs a snapshot of the window/view. No security checks are done. This is
29 // intended to be used for debugging purposes where no BrowserProcess instance 29 // intended to be used for debugging purposes where no BrowserProcess instance
30 // is available (ie. tests). This function is synchronous, so it should NOT be 30 // is available (ie. tests). This function is synchronous, so it should NOT be
31 // used in a result of user action. Support for async vs synchronous 31 // used in a result of user action. Support for async vs synchronous
32 // GrabWindowSnapshot differs by platform. To be most general, use the 32 // GrabWindowSnapshot differs by platform. To be most general, use the
33 // synchronous function first and if it returns false call the async one. 33 // synchronous function first and if it returns false call the async one.
34 SNAPSHOT_EXPORT bool GrabWindowSnapshot( 34 SNAPSHOT_EXPORT bool GrabWindowSnapshot(gfx::NativeWindow window,
35 gfx::NativeWindow window, 35 const gfx::Rect& snapshot_bounds,
36 std::vector<unsigned char>* png_representation, 36 gfx::Image* image);
37 const gfx::Rect& snapshot_bounds);
38 37
39 SNAPSHOT_EXPORT bool GrabViewSnapshot( 38 SNAPSHOT_EXPORT bool GrabViewSnapshot(gfx::NativeView view,
40 gfx::NativeView view, 39 const gfx::Rect& snapshot_bounds,
41 std::vector<unsigned char>* png_representation, 40 gfx::Image* image);
42 const gfx::Rect& snapshot_bounds);
43
44 41
45 // These functions take a snapshot of |source_rect|, specified in layer space 42 // These functions take a snapshot of |source_rect|, specified in layer space
46 // coordinates (DIP for desktop, physical pixels for Android), and scale the 43 // coordinates (DIP for desktop, physical pixels for Android), and scale the
47 // snapshot to |target_size| (in physical pixels), asynchronously. 44 // snapshot to |target_size| (in physical pixels), asynchronously.
48 typedef base::Callback<void(const gfx::Image& snapshot)> 45 typedef base::Callback<void(const gfx::Image& snapshot)>
49 GrabWindowSnapshotAsyncCallback; 46 GrabWindowSnapshotAsyncCallback;
50 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( 47 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync(
51 gfx::NativeWindow window, 48 gfx::NativeWindow window,
52 const gfx::Rect& source_rect, 49 const gfx::Rect& source_rect,
53 const gfx::Size& target_size, 50 const gfx::Size& target_size,
54 scoped_refptr<base::TaskRunner> background_task_runner, 51 scoped_refptr<base::TaskRunner> background_task_runner,
55 const GrabWindowSnapshotAsyncCallback& callback); 52 const GrabWindowSnapshotAsyncCallback& callback);
56 53
57 typedef base::Callback<void(scoped_refptr<base::RefCountedBytes> png_data)> 54 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync(
55 gfx::NativeWindow window,
56 const gfx::Rect& source_rect,
57 const GrabWindowSnapshotAsyncCallback& callback);
58
59 SNAPSHOT_EXPORT void GrabViewSnapshotAsync(
60 gfx::NativeView view,
61 const gfx::Rect& source_rect,
62 const GrabWindowSnapshotAsyncCallback& callback);
63
64 typedef base::Callback<void(scoped_refptr<base::RefCountedMemory> png_data)>
58 GrabWindowSnapshotAsyncPNGCallback; 65 GrabWindowSnapshotAsyncPNGCallback;
59 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( 66 SNAPSHOT_EXPORT void GrabWindowSnapshotAsyncPNG(
60 gfx::NativeWindow window, 67 gfx::NativeWindow window,
61 const gfx::Rect& source_rect, 68 const gfx::Rect& source_rect,
62 scoped_refptr<base::TaskRunner> background_task_runner, 69 scoped_refptr<base::TaskRunner> background_task_runner,
63 const GrabWindowSnapshotAsyncPNGCallback& callback); 70 const GrabWindowSnapshotAsyncPNGCallback& callback);
64 SNAPSHOT_EXPORT void GrabViewSnapshotAsync(
65 gfx::NativeView view,
66 const gfx::Rect& source_rect,
67 scoped_refptr<base::TaskRunner> background_task_runner,
68 const GrabWindowSnapshotAsyncPNGCallback& callback);
69 71
70 } // namespace ui 72 } // namespace ui
71 73
72 #endif // UI_SNAPSHOT_SNAPSHOT_H_ 74 #endif // UI_SNAPSHOT_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « ui/snapshot/screenshot_grabber.cc ('k') | ui/snapshot/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698