| 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..1df4b83c53cf3c3a9e782018a55e878bb26f514a 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) {
|
| + ::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,
|
| @@ -68,7 +77,7 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
|
| // 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)
|
| + 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(),
|
|
|