| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 SNAPSHOT_EXPORT bool GrabWindowSnapshot( | 34 SNAPSHOT_EXPORT bool GrabWindowSnapshot( |
| 35 gfx::NativeWindow window, | 35 gfx::NativeWindow window, |
| 36 std::vector<unsigned char>* png_representation, | 36 std::vector<unsigned char>* png_representation, |
| 37 const gfx::Rect& snapshot_bounds); | 37 const gfx::Rect& snapshot_bounds); |
| 38 | 38 |
| 39 SNAPSHOT_EXPORT bool GrabViewSnapshot( | 39 SNAPSHOT_EXPORT bool GrabViewSnapshot( |
| 40 gfx::NativeView view, | 40 gfx::NativeView view, |
| 41 std::vector<unsigned char>* png_representation, | 41 std::vector<unsigned char>* png_representation, |
| 42 const gfx::Rect& snapshot_bounds); | 42 const gfx::Rect& snapshot_bounds); |
| 43 | 43 |
| 44 // These functions take a snapshot of |source_rect| (specified in Window/DIP |
| 45 // coordinates) from window and scale it to |target_size| (in physical pixels), |
| 46 // asynchronously. |
| 44 typedef base::Callback<void(const gfx::Image& snapshot)> | 47 typedef base::Callback<void(const gfx::Image& snapshot)> |
| 45 GrabWindowSnapshotAsyncCallback; | 48 GrabWindowSnapshotAsyncCallback; |
| 46 // GrabWindowSnapshotAndScaleAsync() copies snapshot of |source_rect| from | |
| 47 // window and scales it to |target_size| asynchronously. | |
| 48 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( | 49 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( |
| 49 gfx::NativeWindow window, | 50 gfx::NativeWindow window, |
| 50 const gfx::Rect& source_rect, | 51 const gfx::Rect& source_rect, |
| 51 const gfx::Size& target_size, | 52 const gfx::Size& target_size, |
| 52 scoped_refptr<base::TaskRunner> background_task_runner, | 53 scoped_refptr<base::TaskRunner> background_task_runner, |
| 53 const GrabWindowSnapshotAsyncCallback& callback); | 54 const GrabWindowSnapshotAsyncCallback& callback); |
| 54 | 55 |
| 55 typedef base::Callback<void(scoped_refptr<base::RefCountedBytes> png_data)> | 56 typedef base::Callback<void(scoped_refptr<base::RefCountedBytes> png_data)> |
| 56 GrabWindowSnapshotAsyncPNGCallback; | 57 GrabWindowSnapshotAsyncPNGCallback; |
| 57 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( | 58 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( |
| 58 gfx::NativeWindow window, | 59 gfx::NativeWindow window, |
| 59 const gfx::Rect& source_rect, | 60 const gfx::Rect& source_rect, |
| 60 scoped_refptr<base::TaskRunner> background_task_runner, | 61 scoped_refptr<base::TaskRunner> background_task_runner, |
| 61 const GrabWindowSnapshotAsyncPNGCallback& callback); | 62 const GrabWindowSnapshotAsyncPNGCallback& callback); |
| 62 SNAPSHOT_EXPORT void GrabViewSnapshotAsync( | 63 SNAPSHOT_EXPORT void GrabViewSnapshotAsync( |
| 63 gfx::NativeView view, | 64 gfx::NativeView view, |
| 64 const gfx::Rect& source_rect, | 65 const gfx::Rect& source_rect, |
| 65 scoped_refptr<base::TaskRunner> background_task_runner, | 66 scoped_refptr<base::TaskRunner> background_task_runner, |
| 66 const GrabWindowSnapshotAsyncPNGCallback& callback); | 67 const GrabWindowSnapshotAsyncPNGCallback& callback); |
| 67 | 68 |
| 68 } // namespace ui | 69 } // namespace ui |
| 69 | 70 |
| 70 #endif // UI_SNAPSHOT_SNAPSHOT_H_ | 71 #endif // UI_SNAPSHOT_SNAPSHOT_H_ |
| OLD | NEW |