Chromium Code Reviews| 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(), |