| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef UI_BASE_X_X11_UTIL_H_ |    5 #ifndef UI_BASE_X_X11_UTIL_H_ | 
|    6 #define UI_BASE_X_X11_UTIL_H_ |    6 #define UI_BASE_X_X11_UTIL_H_ | 
|    7  |    7  | 
|    8 // This file declares utility functions for X11 (Linux only). |    8 // This file declares utility functions for X11 (Linux only). | 
|    9 // |    9 // | 
|   10 // These functions do not require the Xlib headers to be included (which is why |   10 // These functions do not require the Xlib headers to be included (which is why | 
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  294 UI_BASE_EXPORT bool IsX11WindowFullScreen(XID window); |  294 UI_BASE_EXPORT bool IsX11WindowFullScreen(XID window); | 
|  295  |  295  | 
|  296 // Returns true if the window manager supports the given hint. |  296 // Returns true if the window manager supports the given hint. | 
|  297 UI_BASE_EXPORT bool WmSupportsHint(XAtom atom); |  297 UI_BASE_EXPORT bool WmSupportsHint(XAtom atom); | 
|  298  |  298  | 
|  299 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This |  299 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This | 
|  300 // object takes ownership over the passed in memory and will free it with the |  300 // object takes ownership over the passed in memory and will free it with the | 
|  301 // X11 allocator when done. |  301 // X11 allocator when done. | 
|  302 class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory { |  302 class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory { | 
|  303  public: |  303  public: | 
|  304   XRefcountedMemory(unsigned char* x11_data, size_t length) |  304   XRefcountedMemory(unsigned char* x11_data, size_t length); | 
|  305       : x11_data_(length ? x11_data : NULL), length_(length) {} |  | 
|  306  |  305  | 
|  307   // Overridden from RefCountedMemory: |  306   // Overridden from RefCountedMemory: | 
|  308   const unsigned char* front() const override; |  307   const unsigned char* front() const override; | 
|  309   size_t size() const override; |  308   size_t size() const override; | 
|  310  |  309  | 
|  311  private: |  310  private: | 
|  312   ~XRefcountedMemory() override; |  311   ~XRefcountedMemory() override; | 
|  313  |  312  | 
|  314   unsigned char* x11_data_; |  313   gfx::XScopedPtr<unsigned char> x11_data_; | 
|  315   size_t length_; |  314   size_t length_; | 
|  316  |  315  | 
|  317   DISALLOW_COPY_AND_ASSIGN(XRefcountedMemory); |  316   DISALLOW_COPY_AND_ASSIGN(XRefcountedMemory); | 
|  318 }; |  317 }; | 
|  319  |  318  | 
|  320 // Keeps track of a string returned by an X function (e.g. XGetAtomName) and |  | 
|  321 // makes sure it's XFree'd. |  | 
|  322 class UI_BASE_EXPORT XScopedString { |  | 
|  323  public: |  | 
|  324   explicit XScopedString(char* str) : string_(str) {} |  | 
|  325   ~XScopedString(); |  | 
|  326  |  | 
|  327   const char* string() const { return string_; } |  | 
|  328  |  | 
|  329  private: |  | 
|  330   char* string_; |  | 
|  331  |  | 
|  332   DISALLOW_COPY_AND_ASSIGN(XScopedString); |  | 
|  333 }; |  | 
|  334  |  | 
|  335 // Keeps track of an image returned by an X function (e.g. XGetImage) and |  319 // Keeps track of an image returned by an X function (e.g. XGetImage) and | 
|  336 // makes sure it's XDestroyImage'd. |  320 // makes sure it's XDestroyImage'd. | 
|  337 class UI_BASE_EXPORT XScopedImage { |  321 class UI_BASE_EXPORT XScopedImage { | 
|  338  public: |  322  public: | 
|  339   explicit XScopedImage(XImage* image) : image_(image) {} |  323   explicit XScopedImage(XImage* image) : image_(image) {} | 
|  340   ~XScopedImage(); |  324   ~XScopedImage(); | 
|  341  |  325  | 
|  342   XImage* get() const { return image_; } |  326   XImage* get() const { return image_; } | 
|  343  |  327  | 
|  344   XImage* operator->() const { return image_; } |  328   XImage* operator->() const { return image_; } | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|  375 UI_BASE_EXPORT void ResetXCursorCache(); |  359 UI_BASE_EXPORT void ResetXCursorCache(); | 
|  376  |  360  | 
|  377 // Returns the cached XcursorImage for |cursor|. |  361 // Returns the cached XcursorImage for |cursor|. | 
|  378 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); |  362 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); | 
|  379  |  363  | 
|  380 }  // namespace test |  364 }  // namespace test | 
|  381  |  365  | 
|  382 }  // namespace ui |  366 }  // namespace ui | 
|  383  |  367  | 
|  384 #endif  // UI_BASE_X_X11_UTIL_H_ |  368 #endif  // UI_BASE_X_X11_UTIL_H_ | 
| OLD | NEW |