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

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: snapshot_test_support now win-only 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
« no previous file with comments | « ui/snapshot/snapshot_win.h ('k') | ui/snapshot/test/snapshot_desktop.h » ('j') | 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..8c2ff3bd5bf93e8f003aa356c8f310967bd3cc1e 100644
--- a/ui/snapshot/snapshot_win.cc
+++ b/ui/snapshot/snapshot_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/snapshot/snapshot.h"
+#include "ui/snapshot/snapshot_win.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
@@ -11,10 +11,11 @@
#include "ui/gfx/gdi_util.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
+#include "ui/snapshot/snapshot.h"
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);
@@ -36,15 +37,11 @@ gfx::Rect GetWindowBounds(gfx::NativeWindow window_handle) {
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);
-}
+namespace internal {
-bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
- std::vector<unsigned char>* png_representation,
- const gfx::Rect& snapshot_bounds) {
+bool GrabHwndSnapshot(HWND window_handle,
+ const gfx::Rect& snapshot_bounds,
+ std::vector<unsigned char>* png_representation) {
DCHECK(snapshot_bounds.right() <= GetWindowBounds(window_handle).right());
DCHECK(snapshot_bounds.bottom() <= GetWindowBounds(window_handle).bottom());
@@ -103,4 +100,22 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
return true;
}
+} // namespace internal
+
+#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 internal::GrabHwndSnapshot(window_handle, snapshot_bounds,
+ png_representation);
+}
+#endif // !defined(USE_AURA)
+
} // namespace ui
« no previous file with comments | « ui/snapshot/snapshot_win.h ('k') | ui/snapshot/test/snapshot_desktop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698