| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/pickle.h" | 6 #include "base/pickle.h" |
| 7 #include "gfx/gdi_util.h" | 7 #include "gfx/gdi_util.h" |
| 8 #include "grit/webkit_resources.h" | 8 #include "grit/webkit_resources.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
| 11 #include "webkit/glue/webcursor.h" | 11 #include "webkit/glue/webcursor.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 static bool IsSystemCursorID(LPCWSTR cursor_id) { | 104 static bool IsSystemCursorID(LPCWSTR cursor_id) { |
| 105 return cursor_id >= IDC_ARROW; // See WinUser.h | 105 return cursor_id >= IDC_ARROW; // See WinUser.h |
| 106 } | 106 } |
| 107 | 107 |
| 108 static WebCursorInfo::Type ToCursorType(HCURSOR cursor) { | 108 static WebCursorInfo::Type ToCursorType(HCURSOR cursor) { |
| 109 static struct { | 109 static struct { |
| 110 HCURSOR cursor; | 110 HCURSOR cursor; |
| 111 WebCursorInfo::Type type; | 111 WebCursorInfo::Type type; |
| 112 } kStandardCursors[] = { | 112 } kStandardCursors[] = { |
| 113 { LoadCursor(NULL, IDC_ARROW), WebCursorInfo::TypePointer }, | 113 { LoadCursor(NULL, IDC_ARROW), WebCursorInfo::TypePointer }, |
| 114 { LoadCursor(NULL, IDC_CROSS), WebCursorInfo::TypeCross }, |
| 115 { LoadCursor(NULL, IDC_HAND), WebCursorInfo::TypeHand }, |
| 114 { LoadCursor(NULL, IDC_IBEAM), WebCursorInfo::TypeIBeam }, | 116 { LoadCursor(NULL, IDC_IBEAM), WebCursorInfo::TypeIBeam }, |
| 115 { LoadCursor(NULL, IDC_WAIT), WebCursorInfo::TypeWait }, | 117 { LoadCursor(NULL, IDC_WAIT), WebCursorInfo::TypeWait }, |
| 116 { LoadCursor(NULL, IDC_CROSS), WebCursorInfo::TypeCross }, | 118 { LoadCursor(NULL, IDC_HELP), WebCursorInfo::TypeHelp }, |
| 119 { LoadCursor(NULL, IDC_SIZENESW), WebCursorInfo::TypeNorthEastResize }, |
| 117 { LoadCursor(NULL, IDC_SIZENWSE), WebCursorInfo::TypeNorthWestResize }, | 120 { LoadCursor(NULL, IDC_SIZENWSE), WebCursorInfo::TypeNorthWestResize }, |
| 118 { LoadCursor(NULL, IDC_SIZENESW), WebCursorInfo::TypeNorthEastResize }, | 121 { LoadCursor(NULL, IDC_SIZENS), WebCursorInfo::TypeNorthSouthResize }, |
| 119 { LoadCursor(NULL, IDC_SIZEWE), WebCursorInfo::TypeEastWestResize }, | 122 { LoadCursor(NULL, IDC_SIZEWE), WebCursorInfo::TypeEastWestResize }, |
| 120 { LoadCursor(NULL, IDC_SIZENS), WebCursorInfo::TypeNorthSouthResize }, | |
| 121 { LoadCursor(NULL, IDC_SIZEALL), WebCursorInfo::TypeMove }, | 123 { LoadCursor(NULL, IDC_SIZEALL), WebCursorInfo::TypeMove }, |
| 124 { LoadCursor(NULL, IDC_APPSTARTING), WebCursorInfo::TypeProgress }, |
| 122 { LoadCursor(NULL, IDC_NO), WebCursorInfo::TypeNotAllowed }, | 125 { LoadCursor(NULL, IDC_NO), WebCursorInfo::TypeNotAllowed }, |
| 123 { LoadCursor(NULL, IDC_HAND), WebCursorInfo::TypeHand }, | |
| 124 { LoadCursor(NULL, IDC_APPSTARTING), WebCursorInfo::TypeProgress }, | |
| 125 { LoadCursor(NULL, IDC_HELP), WebCursorInfo::TypeHelp }, | |
| 126 }; | 126 }; |
| 127 for (int i = 0; i < arraysize(kStandardCursors); i++) { | 127 for (int i = 0; i < arraysize(kStandardCursors); i++) { |
| 128 if (cursor == kStandardCursors[i].cursor) | 128 if (cursor == kStandardCursors[i].cursor) |
| 129 return kStandardCursors[i].type; | 129 return kStandardCursors[i].type; |
| 130 } | 130 } |
| 131 return WebCursorInfo::TypeCustom; | 131 return WebCursorInfo::TypeCustom; |
| 132 } | 132 } |
| 133 | 133 |
| 134 HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){ | 134 HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){ |
| 135 if (!IsCustom()) { | 135 if (!IsCustom()) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 void WebCursor::CleanupPlatformData() { | 229 void WebCursor::CleanupPlatformData() { |
| 230 external_cursor_ = NULL; | 230 external_cursor_ = NULL; |
| 231 | 231 |
| 232 if (custom_cursor_) { | 232 if (custom_cursor_) { |
| 233 DestroyIcon(custom_cursor_); | 233 DestroyIcon(custom_cursor_); |
| 234 custom_cursor_ = NULL; | 234 custom_cursor_ = NULL; |
| 235 } | 235 } |
| 236 } | 236 } |
| OLD | NEW |