Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: webkit/glue/webcursor.cc

Issue 10916253: Support custom cursors for windowless plugins on Windows Aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webcursor.h ('k') | webkit/glue/webcursor_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webcursor.cc
===================================================================
--- webkit/glue/webcursor.cc (revision 156090)
+++ webkit/glue/webcursor.cc (working copy)
@@ -16,11 +16,17 @@
WebCursor::WebCursor()
: type_(WebCursorInfo::TypePointer) {
+#if defined(OS_WIN)
+ external_cursor_ = NULL;
+#endif
InitPlatformData();
}
WebCursor::WebCursor(const WebCursorInfo& cursor_info)
: type_(WebCursorInfo::TypePointer) {
+#if defined(OS_WIN)
+ external_cursor_ = NULL;
+#endif
InitPlatformData();
InitFromCursorInfo(cursor_info);
}
@@ -46,7 +52,7 @@
void WebCursor::InitFromCursorInfo(const WebCursorInfo& cursor_info) {
Clear();
-#if defined(OS_WIN) && !defined(USE_AURA)
+#if defined(OS_WIN)
if (cursor_info.externalHandle) {
InitFromExternalCursor(cursor_info.externalHandle);
return;
@@ -65,7 +71,7 @@
cursor_info->hotSpot = hotspot_;
ImageFromCustomData(&cursor_info->customImage);
-#if defined(OS_WIN) && !defined(USE_AURA)
+#if defined(OS_WIN)
cursor_info->externalHandle = external_cursor_;
#endif
}
@@ -147,6 +153,45 @@
custom_data_ == other.custom_data_;
}
+#if defined(OS_WIN)
+
+static WebCursorInfo::Type ToCursorType(HCURSOR cursor) {
+ static struct {
+ HCURSOR cursor;
+ WebCursorInfo::Type type;
+ } kStandardCursors[] = {
+ { LoadCursor(NULL, IDC_ARROW), WebCursorInfo::TypePointer },
+ { LoadCursor(NULL, IDC_CROSS), WebCursorInfo::TypeCross },
+ { LoadCursor(NULL, IDC_HAND), WebCursorInfo::TypeHand },
+ { LoadCursor(NULL, IDC_IBEAM), WebCursorInfo::TypeIBeam },
+ { LoadCursor(NULL, IDC_WAIT), WebCursorInfo::TypeWait },
+ { LoadCursor(NULL, IDC_HELP), WebCursorInfo::TypeHelp },
+ { LoadCursor(NULL, IDC_SIZENESW), WebCursorInfo::TypeNorthEastResize },
+ { LoadCursor(NULL, IDC_SIZENWSE), WebCursorInfo::TypeNorthWestResize },
+ { LoadCursor(NULL, IDC_SIZENS), WebCursorInfo::TypeNorthSouthResize },
+ { LoadCursor(NULL, IDC_SIZEWE), WebCursorInfo::TypeEastWestResize },
+ { LoadCursor(NULL, IDC_SIZEALL), WebCursorInfo::TypeMove },
+ { LoadCursor(NULL, IDC_APPSTARTING), WebCursorInfo::TypeProgress },
+ { LoadCursor(NULL, IDC_NO), WebCursorInfo::TypeNotAllowed },
+ };
+ for (int i = 0; i < arraysize(kStandardCursors); i++) {
tony 2012/09/12 18:58:09 Nit: ++i
jam 2012/09/12 19:40:11 Done.
+ if (cursor == kStandardCursors[i].cursor)
+ return kStandardCursors[i].type;
+ }
+ return WebCursorInfo::TypeCustom;
+}
+
+void WebCursor::InitFromExternalCursor(HCURSOR cursor) {
+ WebCursorInfo::Type cursor_type = ToCursorType(cursor);
+
+ InitFromCursorInfo(WebCursorInfo(cursor_type));
+
+ if (cursor_type == WebCursorInfo::TypeCustom)
+ external_cursor_ = cursor;
+}
+
+#endif // defined(OS_WIN)
+
void WebCursor::Clear() {
type_ = WebCursorInfo::TypePointer;
hotspot_.set_x(0);
« no previous file with comments | « webkit/glue/webcursor.h ('k') | webkit/glue/webcursor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698