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

Unified Diff: ui/snapshot/snapshot_win.cc

Issue 13926006: Add ui::GrabDesktopSnapshot for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« ui/snapshot/snapshot.h ('K') | « ui/snapshot/snapshot.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/snapshot/snapshot_win.cc
diff --git a/ui/snapshot/snapshot_win.cc b/ui/snapshot/snapshot_win.cc
index 3a8d1e715765722381f8fa8e25592c039427bdb1..90d2248dd5047262e333a34824daf17d011c8c19 100644
--- a/ui/snapshot/snapshot_win.cc
+++ b/ui/snapshot/snapshot_win.cc
@@ -14,7 +14,7 @@
namespace {
-gfx::Rect GetWindowBounds(gfx::NativeWindow window_handle) {
+gfx::Rect GetWindowBounds(HWND window_handle) {
RECT content_rect = {0, 0, 0, 0};
if (window_handle) {
::GetWindowRect(window_handle, &content_rect);
@@ -32,19 +32,9 @@ gfx::Rect GetWindowBounds(gfx::NativeWindow window_handle) {
content_rect.bottom - content_rect.top);
}
-} // namespace
-
-namespace ui {
-
-bool GrabViewSnapshot(gfx::NativeView view_handle,
- std::vector<unsigned char>* png_representation,
- const gfx::Rect& snapshot_bounds) {
- return GrabWindowSnapshot(view_handle, png_representation, snapshot_bounds);
-}
-
-bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
- std::vector<unsigned char>* png_representation,
- const gfx::Rect& snapshot_bounds) {
+bool GrabWindowSnapshotImpl(HWND window_handle,
+ std::vector<unsigned char>* png_representation,
+ const gfx::Rect& snapshot_bounds) {
DCHECK(snapshot_bounds.right() <= GetWindowBounds(window_handle).right());
DCHECK(snapshot_bounds.bottom() <= GetWindowBounds(window_handle).bottom());
@@ -103,4 +93,31 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
return true;
}
+} // namespace
+
+namespace ui {
+
+#if !defined(USE_AURA)
+
+bool GrabViewSnapshot(gfx::NativeView view_handle,
+ std::vector<unsigned char>* png_representation,
+ const gfx::Rect& snapshot_bounds) {
+ return GrabWindowSnapshot(view_handle, png_representation, snapshot_bounds);
+}
+
+bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
+ std::vector<unsigned char>* png_representation,
+ const gfx::Rect& snapshot_bounds) {
+ DCHECK(window_handle);
+ return GrabWindowSnapshotImpl(window_handle, png_representation,
+ snapshot_bounds);
+}
+
+#endif // !defined(USE_AURA)
+
+bool GrabDesktopSnapshot(std::vector<unsigned char>* png_representation,
+ const gfx::Rect& snapshot_bounds) {
+ return GrabWindowSnapshotImpl(NULL, png_representation, snapshot_bounds);
+}
+
} // namespace ui
« ui/snapshot/snapshot.h ('K') | « ui/snapshot/snapshot.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698