| 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 10 matching lines...) Expand all Loading... |
| 21 class Image; | 21 class Image; |
| 22 class Size; | 22 class Size; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace ui { | 25 namespace ui { |
| 26 | 26 |
| 27 // Grabs a snapshot of the window/view. No security checks are done. This is | 27 // Grabs a snapshot of the window/view. No security checks are done. This is |
| 28 // intended to be used for debugging purposes where no BrowserProcess instance | 28 // intended to be used for debugging purposes where no BrowserProcess instance |
| 29 // is available (ie. tests). This function is synchronous, so it should NOT be | 29 // is available (ie. tests). This function is synchronous, so it should NOT be |
| 30 // used in a result of user action. Use asynchronous GrabWindowSnapshotAsync() | 30 // used in a result of user action. Use asynchronous GrabWindowSnapshotAsync() |
| 31 // instead. | 31 // instead on supported platforms. |
| 32 SNAPSHOT_EXPORT bool GrabWindowSnapshot( | 32 SNAPSHOT_EXPORT bool GrabWindowSnapshot( |
| 33 gfx::NativeWindow window, | 33 gfx::NativeWindow window, |
| 34 std::vector<unsigned char>* png_representation, | 34 std::vector<unsigned char>* png_representation, |
| 35 const gfx::Rect& snapshot_bounds); | 35 const gfx::Rect& snapshot_bounds); |
| 36 | 36 |
| 37 SNAPSHOT_EXPORT bool GrabViewSnapshot( | 37 SNAPSHOT_EXPORT bool GrabViewSnapshot( |
| 38 gfx::NativeView view, | 38 gfx::NativeView view, |
| 39 std::vector<unsigned char>* png_representation, | 39 std::vector<unsigned char>* png_representation, |
| 40 const gfx::Rect& snapshot_bounds); | 40 const gfx::Rect& snapshot_bounds); |
| 41 | 41 |
| 42 // GrabWindowSnapshotAsync() copies snapshot of |source_rect| from window and | |
| 43 // scales it to |target_size| asynchronously. | |
| 44 typedef base::Callback<void(const gfx::Image& snapshot)> | 42 typedef base::Callback<void(const gfx::Image& snapshot)> |
| 45 GrabWindowSnapshotAsyncCallback; | 43 GrabWindowSnapshotAsyncCallback; |
| 46 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( | 44 // GrabWindowSnapshotAndScaleAsync() copies snapshot of |source_rect| from |
| 45 // window and scales it to |target_size| asynchronously. |
| 46 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( |
| 47 gfx::NativeWindow window, | 47 gfx::NativeWindow window, |
| 48 const gfx::Rect& source_rect, | 48 const gfx::Rect& source_rect, |
| 49 const gfx::Size& target_size, | 49 const gfx::Size& target_size, |
| 50 scoped_refptr<base::TaskRunner> background_task_runner, | 50 scoped_refptr<base::TaskRunner> background_task_runner, |
| 51 const GrabWindowSnapshotAsyncCallback& callback); | 51 const GrabWindowSnapshotAsyncCallback& callback); |
| 52 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( |
| 53 gfx::NativeWindow window, |
| 54 const gfx::Rect& source_rect, |
| 55 scoped_refptr<base::TaskRunner> background_task_runner, |
| 56 const GrabWindowSnapshotAsyncCallback& callback); |
| 52 | 57 |
| 53 } // namespace ui | 58 } // namespace ui |
| 54 | 59 |
| 55 #endif // UI_SNAPSHOT_SNAPSHOT_H_ | 60 #endif // UI_SNAPSHOT_SNAPSHOT_H_ |
| OLD | NEW |