Index: ui/base/x/x11_util.h |
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h |
index 411c941baa1dfd4492fc86a866f3d145eeed0d3b..ea83c652cc7431f3c1e65366b4081d49f02fc2e0 100644 |
--- a/ui/base/x/x11_util.h |
+++ b/ui/base/x/x11_util.h |
@@ -255,6 +255,21 @@ UI_EXPORT void InitXKeyEventForTesting(EventType type, |
int flags, |
XEvent* event); |
+// Keeps track of a string returned by an X function (e.g. XGetAtomName) and |
+// makes sure it's XFree'd. |
+class UI_EXPORT XScopedString { |
+ public: |
+ explicit XScopedString(char *str) : string_(str) { } |
sky
2012/02/07 20:55:01
'char *str' -> 'char* str' (same on line 268)
sadrul
2012/02/07 21:30:08
Whoops. Sorry! Fixed.
|
+ ~XScopedString(); |
+ |
+ const char *string() const { return string_; } |
+ |
+ private: |
+ char *string_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(XScopedString); |
+}; |
+ |
} // namespace ui |
#endif // UI_BASE_X_X11_UTIL_H_ |