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_CURSOR_CURSOR_LOADER_X11_H_ | 5 #ifndef UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ |
6 #define UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ | 6 #define UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ |
7 | 7 |
8 #include <X11/Xcursor/Xcursor.h> | 8 #include <X11/Xcursor/Xcursor.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual void LoadImageCursor(int id, | 26 virtual void LoadImageCursor(int id, |
27 int resource_id, | 27 int resource_id, |
28 const gfx::Point& hot) OVERRIDE; | 28 const gfx::Point& hot) OVERRIDE; |
29 virtual void LoadAnimatedCursor(int id, | 29 virtual void LoadAnimatedCursor(int id, |
30 int resource_id, | 30 int resource_id, |
31 const gfx::Point& hot, | 31 const gfx::Point& hot, |
32 int frame_delay_ms) OVERRIDE; | 32 int frame_delay_ms) OVERRIDE; |
33 virtual void UnloadAll() OVERRIDE; | 33 virtual void UnloadAll() OVERRIDE; |
34 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; | 34 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; |
35 | 35 |
| 36 const XcursorImage* GetXcursorImageForTest(int id); |
| 37 |
36 private: | 38 private: |
37 // Returns true if we have an image resource loaded for the |native_cursor|. | 39 // Returns true if we have an image resource loaded for the |native_cursor|. |
38 bool IsImageCursor(gfx::NativeCursor native_cursor); | 40 bool IsImageCursor(gfx::NativeCursor native_cursor); |
39 | 41 |
40 // Gets the X Cursor corresponding to the |native_cursor|. | 42 // Gets the X Cursor corresponding to the |native_cursor|. |
41 ::Cursor ImageCursorFromNative(gfx::NativeCursor native_cursor); | 43 ::Cursor ImageCursorFromNative(gfx::NativeCursor native_cursor); |
42 | 44 |
43 // A map to hold all image cursors. It maps the cursor ID to the X Cursor. | 45 // A map to hold all image cursors. It maps the cursor ID to the X Cursor. |
44 typedef std::map<int, ::Cursor> ImageCursorMap; | 46 typedef std::map<int, ::Cursor> ImageCursorMap; |
45 ImageCursorMap cursors_; | 47 ImageCursorMap cursors_; |
46 | 48 |
47 // A map to hold all animated cursors. It maps the cursor ID to the pair of | 49 // A map to hold all animated cursors. It maps the cursor ID to the pair of |
48 // the X Cursor and the corresponding XcursorImages. We need a pointer to the | 50 // the X Cursor and the corresponding XcursorImages. We need a pointer to the |
49 // images so that we can free them on destruction. | 51 // images so that we can free them on destruction. |
50 typedef std::map<int, std::pair< ::Cursor, XcursorImages*> > | 52 typedef std::map<int, std::pair< ::Cursor, XcursorImages*> > |
51 AnimatedCursorMap; | 53 AnimatedCursorMap; |
52 AnimatedCursorMap animated_cursors_; | 54 AnimatedCursorMap animated_cursors_; |
53 | 55 |
54 const XScopedCursor invisible_cursor_; | 56 const XScopedCursor invisible_cursor_; |
55 | 57 |
56 DISALLOW_COPY_AND_ASSIGN(CursorLoaderX11); | 58 DISALLOW_COPY_AND_ASSIGN(CursorLoaderX11); |
57 }; | 59 }; |
58 | 60 |
59 } // namespace ui | 61 } // namespace ui |
60 | 62 |
61 #endif // UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ | 63 #endif // UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ |
OLD | NEW |