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

Unified Diff: chrome/browser/ui/window_snapshot/window_snapshot_win.cc

Issue 10007043: Attempt to fix ChromeFrameTestWithWebServer tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move snapshot fn into ui_test_utils_win.cc Created 8 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 | « chrome/browser/ui/window_snapshot/window_snapshot.h ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/window_snapshot/window_snapshot_win.cc
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
index f3c52691b503242e871f33ef3ee55e0d9dabac5a..3d8623e8a4ad963473e17c2ec0201f1f08fa5706 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,16 @@ namespace {
gfx::Rect GetWindowBounds(gfx::NativeWindow window_handle) {
RECT content_rect = {0, 0, 0, 0};
- ::GetWindowRect(window_handle, &content_rect);
+ if (window_handle) {
+ ::GetWindowRect(window_handle, &content_rect);
+ } else {
+ MONITORINFO monitor_info = {};
+ monitor_info.cbSize = sizeof(monitor_info);
+ if (GetMonitorInfo(MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY),
+ &monitor_info)) {
+ content_rect = monitor_info.rcMonitor;
+ }
+ }
content_rect.right++; // Match what PrintWindow wants.
return gfx::Rect(content_rect.right - content_rect.left,
@@ -67,8 +76,8 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
// obscured windows, and works better for out of process sub-windows.
// Otherwise grab the bits we can get with BitBlt; it's better
// than nothing and will work fine in the average case (window is
- // completely on screen).
- if (snapshot_bounds.origin() == gfx::Point() && print_window)
+ // completely on screen). Always BitBlt when grabbing the whole screen.
+ if (snapshot_bounds.origin() == gfx::Point() && print_window && window_handle)
(*print_window)(window_handle, mem_hdc, 0);
else
BitBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
« no previous file with comments | « chrome/browser/ui/window_snapshot/window_snapshot.h ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698