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

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: Added retry logic for WidgetModeIE_Version. 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
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..877cb62987dda7430310c84ecf051dca0664fc8a 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
@@ -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) {
robertshield 2012/04/11 17:03:36 perhaps if (IsWindow(window_handle))?
grt (UTC plus 2) 2012/04/11 17:33:08 I don't think so. NULL specifically means the des
+ ::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(),

Powered by Google App Engine
This is Rietveld 408576698