| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/snapshot/snapshot_export.h" | 13 #include "ui/snapshot/snapshot_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TaskRunner; | 16 class TaskRunner; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace gfx { | 19 namespace gfx { |
| 20 class Rect; | 20 class Rect; |
| 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 GrapWindowSnapshotAsync() | 30 // used in a result of user action. Use asynchronous GrabWindowSnapshotAsync() |
| 31 // instead. | 31 // instead. |
| 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 // GrapWindowSnapshotAsync() copies snapshot of |source_rect| from window and | 42 // GrabWindowSnapshotAsync() copies snapshot of |source_rect| from window and |
| 43 // scales it to |target_size| asynchronously. | 43 // scales it to |target_size| asynchronously. |
| 44 typedef base::Callback<void(const gfx::Image& snapshot)> | 44 typedef base::Callback<void(const gfx::Image& snapshot)> |
| 45 GrapWindowSnapshotAsyncCallback; | 45 GrabWindowSnapshotAsyncCallback; |
| 46 SNAPSHOT_EXPORT void GrapWindowSnapshotAsync( | 46 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( |
| 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 GrapWindowSnapshotAsyncCallback& callback); | 51 const GrabWindowSnapshotAsyncCallback& callback); |
| 52 | 52 |
| 53 } // namespace ui | 53 } // namespace ui |
| 54 | 54 |
| 55 #endif // UI_SNAPSHOT_SNAPSHOT_H_ | 55 #endif // UI_SNAPSHOT_SNAPSHOT_H_ |
| OLD | NEW |