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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/pickle.h" | 6 #include "base/pickle.h" |
| 7 #include "content/common/cursors/webcursor.h" |
7 #include "grit/ui_unscaled_resources.h" | 8 #include "grit/ui_unscaled_resources.h" |
8 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 9 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "ui/gfx/icon_util.h" | 11 #include "ui/gfx/icon_util.h" |
11 #include "webkit/common/cursors/webcursor.h" | |
12 | 12 |
13 using blink::WebCursorInfo; | 13 using blink::WebCursorInfo; |
14 | 14 |
15 static LPCWSTR ToCursorID(WebCursorInfo::Type type) { | 15 static LPCWSTR ToCursorID(WebCursorInfo::Type type) { |
16 switch (type) { | 16 switch (type) { |
17 case WebCursorInfo::TypePointer: | 17 case WebCursorInfo::TypePointer: |
18 return IDC_ARROW; | 18 return IDC_ARROW; |
19 case WebCursorInfo::TypeCross: | 19 case WebCursorInfo::TypeCross: |
20 return IDC_CROSS; | 20 return IDC_CROSS; |
21 case WebCursorInfo::TypeHand: | 21 case WebCursorInfo::TypeHand: |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return MAKEINTRESOURCE(IDC_HAND_GRABBING); | 102 return MAKEINTRESOURCE(IDC_HAND_GRABBING); |
103 } | 103 } |
104 NOTREACHED(); | 104 NOTREACHED(); |
105 return NULL; | 105 return NULL; |
106 } | 106 } |
107 | 107 |
108 static bool IsSystemCursorID(LPCWSTR cursor_id) { | 108 static bool IsSystemCursorID(LPCWSTR cursor_id) { |
109 return cursor_id >= IDC_ARROW; // See WinUser.h | 109 return cursor_id >= IDC_ARROW; // See WinUser.h |
110 } | 110 } |
111 | 111 |
| 112 namespace content { |
| 113 |
112 HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){ | 114 HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){ |
113 if (!IsCustom()) { | 115 if (!IsCustom()) { |
114 const wchar_t* cursor_id = | 116 const wchar_t* cursor_id = |
115 ToCursorID(static_cast<WebCursorInfo::Type>(type_)); | 117 ToCursorID(static_cast<WebCursorInfo::Type>(type_)); |
116 | 118 |
117 if (IsSystemCursorID(cursor_id)) | 119 if (IsSystemCursorID(cursor_id)) |
118 module_handle = NULL; | 120 module_handle = NULL; |
119 | 121 |
120 return LoadCursor(module_handle, cursor_id); | 122 return LoadCursor(module_handle, cursor_id); |
121 } | 123 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 174 } |
173 | 175 |
174 void WebCursor::CleanupPlatformData() { | 176 void WebCursor::CleanupPlatformData() { |
175 external_cursor_ = NULL; | 177 external_cursor_ = NULL; |
176 | 178 |
177 if (custom_cursor_) { | 179 if (custom_cursor_) { |
178 DestroyIcon(custom_cursor_); | 180 DestroyIcon(custom_cursor_); |
179 custom_cursor_ = NULL; | 181 custom_cursor_ = NULL; |
180 } | 182 } |
181 } | 183 } |
| 184 |
| 185 } // namespace content |
OLD | NEW |