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

Side by Side Diff: base/scoped_handle_win.h

Issue 303033: Implements AeroPeek of Windows 7.. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gyp ('k') | base/scoped_native_library.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef BASE_SCOPED_HANDLE_WIN_H_ 5 #ifndef BASE_SCOPED_HANDLE_WIN_H_
6 #define BASE_SCOPED_HANDLE_WIN_H_ 6 #define BASE_SCOPED_HANDLE_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 private: 179 private:
180 void Close() { 180 void Close() {
181 if (object_) 181 if (object_)
182 DeleteObject(object_); 182 DeleteObject(object_);
183 } 183 }
184 184
185 T object_; 185 T object_;
186 DISALLOW_COPY_AND_ASSIGN(ScopedGDIObject); 186 DISALLOW_COPY_AND_ASSIGN(ScopedGDIObject);
187 }; 187 };
188 188
189 // An explicit specialization for HICON because we have to call DestroyIcon()
190 // instead of DeleteObject() for HICON.
191 template<>
192 void ScopedGDIObject<HICON>::Close() {
193 if (object_)
194 DestroyIcon(object_);
195 }
196
189 // Typedefs for some common use cases. 197 // Typedefs for some common use cases.
190 typedef ScopedGDIObject<HBITMAP> ScopedBitmap; 198 typedef ScopedGDIObject<HBITMAP> ScopedBitmap;
191 typedef ScopedGDIObject<HRGN> ScopedRegion; 199 typedef ScopedGDIObject<HRGN> ScopedRegion;
192 typedef ScopedGDIObject<HFONT> ScopedHFONT; 200 typedef ScopedGDIObject<HFONT> ScopedHFONT;
193 201 typedef ScopedGDIObject<HICON> ScopedHICON;
194 202
195 // Like ScopedHandle except for HGLOBAL. 203 // Like ScopedHandle except for HGLOBAL.
196 template<class T> 204 template<class T>
197 class ScopedHGlobal { 205 class ScopedHGlobal {
198 public: 206 public:
199 explicit ScopedHGlobal(HGLOBAL glob) : glob_(glob) { 207 explicit ScopedHGlobal(HGLOBAL glob) : glob_(glob) {
200 data_ = static_cast<T*>(GlobalLock(glob_)); 208 data_ = static_cast<T*>(GlobalLock(glob_));
201 } 209 }
202 ~ScopedHGlobal() { 210 ~ScopedHGlobal() {
203 GlobalUnlock(glob_); 211 GlobalUnlock(glob_);
(...skipping 10 matching lines...) Expand all
214 222
215 private: 223 private:
216 HGLOBAL glob_; 224 HGLOBAL glob_;
217 225
218 T* data_; 226 T* data_;
219 227
220 DISALLOW_EVIL_CONSTRUCTORS(ScopedHGlobal); 228 DISALLOW_EVIL_CONSTRUCTORS(ScopedHGlobal);
221 }; 229 };
222 230
223 #endif // BASE_SCOPED_HANDLE_WIN_H_ 231 #endif // BASE_SCOPED_HANDLE_WIN_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/scoped_native_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698