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 CONTENT_COMMON_CURSORS_WEBCURSOR_H_ | 5 #ifndef CONTENT_COMMON_CURSORS_WEBCURSOR_H_ |
6 #define CONTENT_COMMON_CURSORS_WEBCURSOR_H_ | 6 #define CONTENT_COMMON_CURSORS_WEBCURSOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 12 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
13 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
17 | 17 |
18 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
19 #include "ui/base/cursor/cursor.h" | 19 #include "ui/base/cursor/cursor.h" |
20 #endif | 20 #endif |
21 | 21 |
22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
23 typedef struct HINSTANCE__* HINSTANCE; | 23 typedef struct HINSTANCE__* HINSTANCE; |
24 typedef struct HICON__* HICON; | 24 typedef struct HICON__* HICON; |
25 typedef HICON HCURSOR; | 25 typedef HICON HCURSOR; |
26 #elif defined(TOOLKIT_GTK) | |
27 typedef struct _GdkCursor GdkCursor; | |
28 #elif defined(OS_MACOSX) | 26 #elif defined(OS_MACOSX) |
29 #ifdef __OBJC__ | 27 #ifdef __OBJC__ |
30 @class NSCursor; | 28 @class NSCursor; |
31 #else | 29 #else |
32 class NSCursor; | 30 class NSCursor; |
33 #endif | 31 #endif |
34 #endif | 32 #endif |
35 | 33 |
36 class Pickle; | 34 class Pickle; |
37 class PickleIterator; | 35 class PickleIterator; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 108 |
111 // Updates |device_scale_factor_| and |rotation_| based on |display|. | 109 // Updates |device_scale_factor_| and |rotation_| based on |display|. |
112 void SetDisplayInfo(const gfx::Display& display); | 110 void SetDisplayInfo(const gfx::Display& display); |
113 | 111 |
114 #elif defined(OS_WIN) | 112 #elif defined(OS_WIN) |
115 // Returns a HCURSOR representing the current WebCursor instance. | 113 // Returns a HCURSOR representing the current WebCursor instance. |
116 // The ownership of the HCURSOR (does not apply to external cursors) remains | 114 // The ownership of the HCURSOR (does not apply to external cursors) remains |
117 // with the WebCursor instance. | 115 // with the WebCursor instance. |
118 HCURSOR GetCursor(HINSTANCE module_handle); | 116 HCURSOR GetCursor(HINSTANCE module_handle); |
119 | 117 |
120 #elif defined(TOOLKIT_GTK) | |
121 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP | |
122 // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor | |
123 // should be set to the system default. | |
124 // Returns an int so we don't need to include GDK headers in this header file. | |
125 int GetCursorType() const; | |
126 | |
127 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType | |
128 // returns GDK_CURSOR_IS_PIXMAP. | |
129 GdkCursor* GetCustomCursor(); | |
130 #elif defined(OS_MACOSX) | 118 #elif defined(OS_MACOSX) |
131 // Initialize this from the given Cocoa NSCursor. | 119 // Initialize this from the given Cocoa NSCursor. |
132 void InitFromNSCursor(NSCursor* cursor); | 120 void InitFromNSCursor(NSCursor* cursor); |
133 #endif | 121 #endif |
134 | 122 |
135 private: | 123 private: |
136 // Copies the contents of the WebCursor instance passed in. | 124 // Copies the contents of the WebCursor instance passed in. |
137 void Copy(const WebCursor& other); | 125 void Copy(const WebCursor& other); |
138 | 126 |
139 // Cleans up the WebCursor instance. | 127 // Cleans up the WebCursor instance. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #endif | 169 #endif |
182 | 170 |
183 #if defined(USE_AURA) && (defined(USE_X11) || defined(USE_OZONE)) | 171 #if defined(USE_AURA) && (defined(USE_X11) || defined(USE_OZONE)) |
184 // Only used for custom cursors. | 172 // Only used for custom cursors. |
185 ui::PlatformCursor platform_cursor_; | 173 ui::PlatformCursor platform_cursor_; |
186 float device_scale_factor_; | 174 float device_scale_factor_; |
187 gfx::Display::Rotation rotation_; | 175 gfx::Display::Rotation rotation_; |
188 #elif defined(OS_WIN) | 176 #elif defined(OS_WIN) |
189 // A custom cursor created from custom bitmap data by Webkit. | 177 // A custom cursor created from custom bitmap data by Webkit. |
190 HCURSOR custom_cursor_; | 178 HCURSOR custom_cursor_; |
191 #elif defined(TOOLKIT_GTK) | |
192 // A custom cursor created that should be unref'ed from the destructor. | |
193 GdkCursor* unref_; | |
194 #endif | 179 #endif |
195 }; | 180 }; |
196 | 181 |
197 } // namespace content | 182 } // namespace content |
198 | 183 |
199 #endif // CONTENT_COMMON_CURSORS_WEBCURSOR_H_ | 184 #endif // CONTENT_COMMON_CURSORS_WEBCURSOR_H_ |
OLD | NEW |