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

Side by Side Diff: chrome/browser/ui/window_snapshot/window_snapshot_win.cc

Issue 10830158: Refactor GrabWindowSnapshot and GrabWindowSnapshotImpl names to GrabWindowSnapshotForUser and GrabW… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed compiling tests, fixed indent Created 8 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
6 6
7 #include "base/win/scoped_gdi_object.h" 7 #include "base/win/scoped_gdi_object.h"
8 #include "base/win/scoped_hdc.h" 8 #include "base/win/scoped_hdc.h"
9 #include "base/win/scoped_select_object.h" 9 #include "base/win/scoped_select_object.h"
10 #include "ui/gfx/codec/png_codec.h" 10 #include "ui/gfx/codec/png_codec.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 content_rect.right++; // Match what PrintWindow wants. 29 content_rect.right++; // Match what PrintWindow wants.
30 30
31 return gfx::Rect(content_rect.right - content_rect.left, 31 return gfx::Rect(content_rect.right - content_rect.left,
32 content_rect.bottom - content_rect.top); 32 content_rect.bottom - content_rect.top);
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 namespace chrome { 37 namespace chrome {
38 namespace internal {
38 39
39 bool GrabWindowSnapshotImpl(gfx::NativeWindow window_handle, 40 bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
40 std::vector<unsigned char>* png_representation, 41 std::vector<unsigned char>* png_representation,
41 const gfx::Rect& snapshot_bounds) { 42 const gfx::Rect& snapshot_bounds) {
42 DCHECK(snapshot_bounds.right() <= GetWindowBounds(window_handle).right()); 43 DCHECK(snapshot_bounds.right() <= GetWindowBounds(window_handle).right());
43 DCHECK(snapshot_bounds.bottom() <= GetWindowBounds(window_handle).bottom()); 44 DCHECK(snapshot_bounds.bottom() <= GetWindowBounds(window_handle).bottom());
44 45
45 // Create a memory DC that's compatible with the window. 46 // Create a memory DC that's compatible with the window.
46 HDC window_hdc = GetWindowDC(window_handle); 47 HDC window_hdc = GetWindowDC(window_handle);
47 base::win::ScopedCreateDC mem_hdc(CreateCompatibleDC(window_hdc)); 48 base::win::ScopedCreateDC mem_hdc(CreateCompatibleDC(window_hdc));
48 49
49 BITMAPINFOHEADER hdr; 50 BITMAPINFOHEADER hdr;
50 gfx::CreateBitmapHeader(snapshot_bounds.width(), 51 gfx::CreateBitmapHeader(snapshot_bounds.width(),
51 snapshot_bounds.height(), 52 snapshot_bounds.height(),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 snapshot_bounds.size(), 91 snapshot_bounds.size(),
91 snapshot_bounds.width() * 4, true, 92 snapshot_bounds.width() * 4, true,
92 std::vector<gfx::PNGCodec::Comment>(), 93 std::vector<gfx::PNGCodec::Comment>(),
93 png_representation); 94 png_representation);
94 95
95 ReleaseDC(window_handle, window_hdc); 96 ReleaseDC(window_handle, window_hdc);
96 97
97 return true; 98 return true;
98 } 99 }
99 100
101 } // namespace internal
100 } // namespace chrome 102 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm ('k') | chrome/test/base/ui_test_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698