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

Unified Diff: base/win/scoped_gdi_object.h

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/scoped_comptr_unittest.cc ('k') | base/win/scoped_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/scoped_gdi_object.h
diff --git a/base/win/scoped_gdi_object.h b/base/win/scoped_gdi_object.h
deleted file mode 100644
index 57b013e2fbaae8cf80fc7f32a452b204fc4b923c..0000000000000000000000000000000000000000
--- a/base/win/scoped_gdi_object.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_WIN_SCOPED_GDI_OBJECT_H_
-#define BASE_WIN_SCOPED_GDI_OBJECT_H_
-
-#include <windows.h>
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-namespace base {
-namespace win {
-
-// Like ScopedHandle but for GDI objects.
-template<class T>
-class ScopedGDIObject {
- public:
- ScopedGDIObject() : object_(NULL) {}
- explicit ScopedGDIObject(T object) : object_(object) {}
-
- ~ScopedGDIObject() {
- Close();
- }
-
- T Get() {
- return object_;
- }
-
- void Set(T object) {
- if (object_ && object != object_)
- Close();
- object_ = object;
- }
-
- ScopedGDIObject& operator=(T object) {
- Set(object);
- return *this;
- }
-
- T release() {
- T object = object_;
- object_ = NULL;
- return object;
- }
-
- operator T() { return object_; }
-
- private:
- void Close() {
- if (object_)
- DeleteObject(object_);
- }
-
- T object_;
- DISALLOW_COPY_AND_ASSIGN(ScopedGDIObject);
-};
-
-// An explicit specialization for HICON because we have to call DestroyIcon()
-// instead of DeleteObject() for HICON.
-template<>
-void inline ScopedGDIObject<HICON>::Close() {
- if (object_)
- DestroyIcon(object_);
-}
-
-// Typedefs for some common use cases.
-typedef ScopedGDIObject<HBITMAP> ScopedBitmap;
-typedef ScopedGDIObject<HRGN> ScopedRegion;
-typedef ScopedGDIObject<HFONT> ScopedHFONT;
-typedef ScopedGDIObject<HICON> ScopedHICON;
-
-} // namespace win
-} // namespace base
-
-#endif // BASE_WIN_SCOPED_GDI_OBJECT_H_
« no previous file with comments | « base/win/scoped_comptr_unittest.cc ('k') | base/win/scoped_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698