| 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 WEBKIT_GLUE_WEBCURSOR_H_ | 5 #ifndef WEBKIT_GLUE_WEBCURSOR_H_ |
| 6 #define WEBKIT_GLUE_WEBCURSOR_H_ | 6 #define WEBKIT_GLUE_WEBCURSOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #ifdef __OBJC__ | 23 #ifdef __OBJC__ |
| 24 @class NSCursor; | 24 @class NSCursor; |
| 25 #else | 25 #else |
| 26 class NSCursor; | 26 class NSCursor; |
| 27 #endif | 27 #endif |
| 28 typedef UInt32 ThemeCursor; | 28 typedef UInt32 ThemeCursor; |
| 29 struct Cursor; | 29 struct Cursor; |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 class Pickle; | 32 class Pickle; |
| 33 class PickleIterator; |
| 33 | 34 |
| 34 namespace WebKit { | 35 namespace WebKit { |
| 35 class WebImage; | 36 class WebImage; |
| 36 struct WebCursorInfo; | 37 struct WebCursorInfo; |
| 37 } | 38 } |
| 38 | 39 |
| 39 // This class encapsulates a cross-platform description of a cursor. Platform | 40 // This class encapsulates a cross-platform description of a cursor. Platform |
| 40 // specific methods are provided to translate the cross-platform cursor into a | 41 // specific methods are provided to translate the cross-platform cursor into a |
| 41 // platform specific cursor. It is also possible to serialize / de-serialize a | 42 // platform specific cursor. It is also possible to serialize / de-serialize a |
| 42 // WebCursor. | 43 // WebCursor. |
| 43 class WEBKIT_GLUE_EXPORT WebCursor { | 44 class WEBKIT_GLUE_EXPORT WebCursor { |
| 44 public: | 45 public: |
| 45 WebCursor(); | 46 WebCursor(); |
| 46 explicit WebCursor(const WebKit::WebCursorInfo& cursor_info); | 47 explicit WebCursor(const WebKit::WebCursorInfo& cursor_info); |
| 47 ~WebCursor(); | 48 ~WebCursor(); |
| 48 | 49 |
| 49 // Copy constructor/assignment operator combine. | 50 // Copy constructor/assignment operator combine. |
| 50 WebCursor(const WebCursor& other); | 51 WebCursor(const WebCursor& other); |
| 51 const WebCursor& operator=(const WebCursor& other); | 52 const WebCursor& operator=(const WebCursor& other); |
| 52 | 53 |
| 53 // Conversion from/to WebCursorInfo. | 54 // Conversion from/to WebCursorInfo. |
| 54 void InitFromCursorInfo(const WebKit::WebCursorInfo& cursor_info); | 55 void InitFromCursorInfo(const WebKit::WebCursorInfo& cursor_info); |
| 55 void GetCursorInfo(WebKit::WebCursorInfo* cursor_info) const; | 56 void GetCursorInfo(WebKit::WebCursorInfo* cursor_info) const; |
| 56 | 57 |
| 57 // Serialization / De-serialization | 58 // Serialization / De-serialization |
| 58 bool Deserialize(const Pickle* pickle, void** iter); | 59 bool Deserialize(PickleIterator* iter); |
| 59 bool Serialize(Pickle* pickle) const; | 60 bool Serialize(Pickle* pickle) const; |
| 60 | 61 |
| 61 // Returns true if GetCustomCursor should be used to allocate a platform | 62 // Returns true if GetCustomCursor should be used to allocate a platform |
| 62 // specific cursor object. Otherwise GetCursor should be used. | 63 // specific cursor object. Otherwise GetCursor should be used. |
| 63 bool IsCustom() const; | 64 bool IsCustom() const; |
| 64 | 65 |
| 65 // Returns true if the current cursor object contains the same cursor as the | 66 // Returns true if the current cursor object contains the same cursor as the |
| 66 // cursor object passed in. If the current cursor is a custom cursor, we also | 67 // cursor object passed in. If the current cursor is a custom cursor, we also |
| 67 // compare the bitmaps to verify whether they are equal. | 68 // compare the bitmaps to verify whether they are equal. |
| 68 bool IsEqual(const WebCursor& other) const; | 69 bool IsEqual(const WebCursor& other) const; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void Copy(const WebCursor& other); | 108 void Copy(const WebCursor& other); |
| 108 | 109 |
| 109 // Cleans up the WebCursor instance. | 110 // Cleans up the WebCursor instance. |
| 110 void Clear(); | 111 void Clear(); |
| 111 | 112 |
| 112 // Platform specific initialization goes here. | 113 // Platform specific initialization goes here. |
| 113 void InitPlatformData(); | 114 void InitPlatformData(); |
| 114 | 115 |
| 115 // Platform specific Serialization / De-serialization | 116 // Platform specific Serialization / De-serialization |
| 116 bool SerializePlatformData(Pickle* pickle) const; | 117 bool SerializePlatformData(Pickle* pickle) const; |
| 117 bool DeserializePlatformData(const Pickle* pickle, void** iter); | 118 bool DeserializePlatformData(PickleIterator* iter); |
| 118 | 119 |
| 119 // Returns true if the platform data in the current cursor object | 120 // Returns true if the platform data in the current cursor object |
| 120 // matches that of the cursor passed in. | 121 // matches that of the cursor passed in. |
| 121 bool IsPlatformDataEqual(const WebCursor& other) const ; | 122 bool IsPlatformDataEqual(const WebCursor& other) const ; |
| 122 | 123 |
| 123 // Copies platform specific data from the WebCursor instance passed in. | 124 // Copies platform specific data from the WebCursor instance passed in. |
| 124 void CopyPlatformData(const WebCursor& other); | 125 void CopyPlatformData(const WebCursor& other); |
| 125 | 126 |
| 126 // Platform specific cleanup. | 127 // Platform specific cleanup. |
| 127 void CleanupPlatformData(); | 128 void CleanupPlatformData(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 148 HCURSOR external_cursor_; | 149 HCURSOR external_cursor_; |
| 149 // A custom cursor created from custom bitmap data by Webkit. | 150 // A custom cursor created from custom bitmap data by Webkit. |
| 150 HCURSOR custom_cursor_; | 151 HCURSOR custom_cursor_; |
| 151 #elif defined(TOOLKIT_USES_GTK) | 152 #elif defined(TOOLKIT_USES_GTK) |
| 152 // A custom cursor created that should be unref'ed from the destructor. | 153 // A custom cursor created that should be unref'ed from the destructor. |
| 153 GdkCursor* unref_; | 154 GdkCursor* unref_; |
| 154 #endif | 155 #endif |
| 155 }; | 156 }; |
| 156 | 157 |
| 157 #endif // WEBKIT_GLUE_WEBCURSOR_H_ | 158 #endif // WEBKIT_GLUE_WEBCURSOR_H_ |
| OLD | NEW |