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

Side by Side Diff: ui/base/gtk/scoped_handle_gtk.h

Issue 9595003: gtk: Move ScopedRegion into scoped_region.{h,cc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing UI_EXPORT to fix the undefined reference error Created 8 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 | « chrome/browser/ui/views/dropdown_bar_host.cc ('k') | ui/base/gtk/scoped_region.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_GTK_SCOPED_HANDLE_GTK_H_
6 #define UI_BASE_GTK_SCOPED_HANDLE_GTK_H_
7 #pragma once
8
9 #include <gdk/gdk.h>
10
11 namespace ui {
12
13 // Wraps a GdkRegion. This class provides the same methods as ScopedGDIObject in
14 // scoped_handle_win.
15 class ScopedRegion {
16 public:
17 ScopedRegion() : region_(NULL) {}
18 explicit ScopedRegion(GdkRegion* region) : region_(region) {}
19
20 ~ScopedRegion() {
21 Close();
22 }
23
24 void Set(GdkRegion* region) {
25 Close();
26
27 region_ = region;
28 }
29
30 GdkRegion* Get() {
31 return region_;
32 }
33
34 GdkRegion* release() {
35 GdkRegion* region = region_;
36 region_ = NULL;
37 return region;
38 }
39
40 private:
41 void Close() {
42 if (region_) {
43 gdk_region_destroy(region_);
44 region_ = NULL;
45 }
46 }
47
48 GdkRegion* region_;
49
50 DISALLOW_COPY_AND_ASSIGN(ScopedRegion);
51 };
52
53 } // namespace ui
54
55 #endif // UI_BASE_GTK_SCOPED_HANDLE_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dropdown_bar_host.cc ('k') | ui/base/gtk/scoped_region.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698