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..86955bf5d3e783ab89812b8f4f50b660aadadd0d 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) { } |
+ ~XScopedString(); |
+ |
+ const char* string() const { return string_; } |
+ |
+ private: |
+ char* string_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(XScopedString); |
+}; |
+ |
} // namespace ui |
#endif // UI_BASE_X_X11_UTIL_H_ |