summaryrefslogtreecommitdiffstats
path: root/base/scoped_handle_gtk.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 00:38:45 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 00:38:45 +0000
commitb7aaf42c6a4a3ce2b45801079f6f7dbea073d0e8 (patch)
tree312d25b9356bfc94bdff0983a831dcd6968d05e8 /base/scoped_handle_gtk.h
parenteebc0b413d66975e86be3814103438c3ec154bec (diff)
downloadchromium_src-b7aaf42c6a4a3ce2b45801079f6f7dbea073d0e8.zip
chromium_src-b7aaf42c6a4a3ce2b45801079f6f7dbea073d0e8.tar.gz
chromium_src-b7aaf42c6a4a3ce2b45801079f6f7dbea073d0e8.tar.bz2
Gets find bar animation/clipping to work on views/gtk.
BUG=none TEST=none Review URL: http://codereview.chromium.org/340077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_handle_gtk.h')
-rw-r--r--base/scoped_handle_gtk.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/base/scoped_handle_gtk.h b/base/scoped_handle_gtk.h
new file mode 100644
index 0000000..06dd64d
--- /dev/null
+++ b/base/scoped_handle_gtk.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2009 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_SCOPED_HANDLE_GTK_H_
+#define BASE_SCOPED_HANDLE_GTK_H_
+
+#include <gdk/gdk.h>
+
+// Wraps a GdkRegion. This class provides the same methods as ScopedGDIObject in
+// scoped_handle_win.
+class ScopedRegion {
+ public:
+ ScopedRegion() : region_(NULL) {}
+ explicit ScopedRegion(GdkRegion* region) : region_(region) {}
+
+ ~ScopedRegion() {
+ Close();
+ }
+
+ void Set(GdkRegion* region) {
+ Close();
+
+ region_ = region;
+ }
+
+ GdkRegion* Get() {
+ return region_;
+ }
+
+ GdkRegion* release() {
+ GdkRegion* region = region_;
+ region_ = NULL;
+ return region;
+ }
+
+ private:
+ void Close() {
+ if (region_) {
+ gdk_region_destroy(region_);
+ region_ = NULL;
+ }
+ }
+
+ GdkRegion* region_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedRegion);
+};
+
+#endif // BASE_SCOPED_HANDLE_GTK_H_