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 0885c7bd8e93194f38f73915b99d73ea05eba52b..2d30dad10448a85de52ee78e09d2db276d06fd43 100644 |
--- a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc |
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc |
@@ -6,6 +6,7 @@ |
#include "base/win/scoped_gdi_object.h" |
#include "base/win/scoped_hdc.h" |
+#include "base/win/scoped_select_object.h" |
#include "ui/gfx/codec/png_codec.h" |
#include "ui/gfx/gdi_util.h" |
#include "ui/gfx/rect.h" |
@@ -17,7 +18,7 @@ gfx::Rect GrabWindowSnapshot(gfx::NativeWindow window_handle, |
std::vector<unsigned char>* png_representation) { |
// Create a memory DC that's compatible with the window. |
HDC window_hdc = GetWindowDC(window_handle); |
- base::win::ScopedHDC mem_hdc(CreateCompatibleDC(window_hdc)); |
+ base::win::ScopedCreateDC mem_hdc(CreateCompatibleDC(window_hdc)); |
// Create a DIB that's the same size as the window. |
RECT content_rect = {0, 0, 0, 0}; |
@@ -35,7 +36,7 @@ gfx::Rect GrabWindowSnapshot(gfx::NativeWindow window_handle, |
reinterpret_cast<void **>(&bit_ptr), |
NULL, 0)); |
- SelectObject(mem_hdc, bitmap); |
+ base::win::ScopedSelectObject select_bitmap(mem_hdc, bitmap); |
// Clear the bitmap to white (so that rounded corners on windows |
// show up on a white background, and strangely-shaped windows |
// look reasonable). Not capturing an alpha mask saves a |