| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "webkit/glue/webcursor.h" | 5 #include "webkit/glue/webcursor.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 case WebCursorInfo::TypeGrab: | 134 case WebCursorInfo::TypeGrab: |
| 135 case WebCursorInfo::TypeGrabbing: | 135 case WebCursorInfo::TypeGrabbing: |
| 136 case WebCursorInfo::TypeCustom: | 136 case WebCursorInfo::TypeCustom: |
| 137 return GDK_CURSOR_IS_PIXMAP; | 137 return GDK_CURSOR_IS_PIXMAP; |
| 138 } | 138 } |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 return GDK_LAST_CURSOR; | 140 return GDK_LAST_CURSOR; |
| 141 } | 141 } |
| 142 | 142 |
| 143 gfx::NativeCursor WebCursor::GetNativeCursor() { | 143 gfx::NativeCursor WebCursor::GetNativeCursor() { |
| 144 #if defined(USE_AURA) | |
| 145 // TODO(saintlou): | |
| 146 return NULL; | |
| 147 #else | |
| 148 int type = GetCursorType(); | 144 int type = GetCursorType(); |
| 149 if (type == GDK_CURSOR_IS_PIXMAP) | 145 if (type == GDK_CURSOR_IS_PIXMAP) |
| 150 return GetCustomCursor(); | 146 return GetCustomCursor(); |
| 151 return gfx::GetCursor(type); | 147 return gfx::GetCursor(type); |
| 152 #endif | |
| 153 } | 148 } |
| 154 | 149 |
| 155 GdkCursor* WebCursor::GetCustomCursor() { | 150 GdkCursor* WebCursor::GetCustomCursor() { |
| 156 #if defined(USE_AURA) | |
| 157 // TODO(saintlou): | |
| 158 return NULL; | |
| 159 #else | |
| 160 switch (type_) { | 151 switch (type_) { |
| 161 case WebCursorInfo::TypeZoomIn: | 152 case WebCursorInfo::TypeZoomIn: |
| 162 return GetInlineCustomCursor(CustomCursorZoomIn); | 153 return GetInlineCustomCursor(CustomCursorZoomIn); |
| 163 case WebCursorInfo::TypeZoomOut: | 154 case WebCursorInfo::TypeZoomOut: |
| 164 return GetInlineCustomCursor(CustomCursorZoomOut); | 155 return GetInlineCustomCursor(CustomCursorZoomOut); |
| 165 case WebCursorInfo::TypeGrab: | 156 case WebCursorInfo::TypeGrab: |
| 166 return GetInlineCustomCursor(CustomCursorGrab); | 157 return GetInlineCustomCursor(CustomCursorGrab); |
| 167 case WebCursorInfo::TypeGrabbing: | 158 case WebCursorInfo::TypeGrabbing: |
| 168 return GetInlineCustomCursor(CustomCursorGrabbing); | 159 return GetInlineCustomCursor(CustomCursorGrabbing); |
| 169 } | 160 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 184 pixbuf, | 175 pixbuf, |
| 185 hotspot_.x(), | 176 hotspot_.x(), |
| 186 hotspot_.y()); | 177 hotspot_.y()); |
| 187 | 178 |
| 188 gdk_pixbuf_unref(pixbuf); | 179 gdk_pixbuf_unref(pixbuf); |
| 189 | 180 |
| 190 if (unref_) | 181 if (unref_) |
| 191 gdk_cursor_unref(unref_); | 182 gdk_cursor_unref(unref_); |
| 192 unref_ = cursor; | 183 unref_ = cursor; |
| 193 return cursor; | 184 return cursor; |
| 194 #endif | |
| 195 } | 185 } |
| 196 | 186 |
| 197 void WebCursor::InitPlatformData() { | 187 void WebCursor::InitPlatformData() { |
| 198 unref_ = NULL; | 188 unref_ = NULL; |
| 199 return; | 189 return; |
| 200 } | 190 } |
| 201 | 191 |
| 202 bool WebCursor::SerializePlatformData(Pickle* pickle) const { | 192 bool WebCursor::SerializePlatformData(Pickle* pickle) const { |
| 203 return true; | 193 return true; |
| 204 } | 194 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 217 unref_ = NULL; | 207 unref_ = NULL; |
| 218 } | 208 } |
| 219 return; | 209 return; |
| 220 } | 210 } |
| 221 | 211 |
| 222 void WebCursor::CopyPlatformData(const WebCursor& other) { | 212 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 223 if (other.unref_) | 213 if (other.unref_) |
| 224 unref_ = gdk_cursor_ref(other.unref_); | 214 unref_ = gdk_cursor_ref(other.unref_); |
| 225 return; | 215 return; |
| 226 } | 216 } |
| OLD | NEW |