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
3 // found in the LICENSE file.
5 #include "webkit/glue/webcursor.h"
7 #include "base/logging.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
9 #include "ui/base/cursor/cursor.h"
11 using WebKit::WebCursorInfo
;
13 gfx::NativeCursor
WebCursor::GetNativeCursor() {
15 case WebCursorInfo::TypePointer
:
16 return ui::kCursorPointer
;
17 case WebCursorInfo::TypeCross
:
18 return ui::kCursorCross
;
19 case WebCursorInfo::TypeHand
:
20 return ui::kCursorHand
;
21 case WebCursorInfo::TypeIBeam
:
22 return ui::kCursorIBeam
;
23 case WebCursorInfo::TypeWait
:
24 return ui::kCursorWait
;
25 case WebCursorInfo::TypeHelp
:
26 return ui::kCursorHelp
;
27 case WebCursorInfo::TypeEastResize
:
28 return ui::kCursorEastResize
;
29 case WebCursorInfo::TypeNorthResize
:
30 return ui::kCursorNorthResize
;
31 case WebCursorInfo::TypeNorthEastResize
:
32 return ui::kCursorNorthEastResize
;
33 case WebCursorInfo::TypeNorthWestResize
:
34 return ui::kCursorNorthWestResize
;
35 case WebCursorInfo::TypeSouthResize
:
36 return ui::kCursorSouthResize
;
37 case WebCursorInfo::TypeSouthEastResize
:
38 return ui::kCursorSouthEastResize
;
39 case WebCursorInfo::TypeSouthWestResize
:
40 return ui::kCursorSouthWestResize
;
41 case WebCursorInfo::TypeWestResize
:
42 return ui::kCursorWestResize
;
43 case WebCursorInfo::TypeNorthSouthResize
:
44 return ui::kCursorNorthSouthResize
;
45 case WebCursorInfo::TypeEastWestResize
:
46 return ui::kCursorEastWestResize
;
47 case WebCursorInfo::TypeNorthEastSouthWestResize
:
48 return ui::kCursorNorthEastSouthWestResize
;
49 case WebCursorInfo::TypeNorthWestSouthEastResize
:
50 return ui::kCursorNorthWestSouthEastResize
;
51 case WebCursorInfo::TypeColumnResize
:
52 return ui::kCursorColumnResize
;
53 case WebCursorInfo::TypeRowResize
:
54 return ui::kCursorRowResize
;
55 case WebCursorInfo::TypeMiddlePanning
:
56 return ui::kCursorMiddlePanning
;
57 case WebCursorInfo::TypeEastPanning
:
58 return ui::kCursorEastPanning
;
59 case WebCursorInfo::TypeNorthPanning
:
60 return ui::kCursorNorthPanning
;
61 case WebCursorInfo::TypeNorthEastPanning
:
62 return ui::kCursorNorthEastPanning
;
63 case WebCursorInfo::TypeNorthWestPanning
:
64 return ui::kCursorNorthWestPanning
;
65 case WebCursorInfo::TypeSouthPanning
:
66 return ui::kCursorSouthPanning
;
67 case WebCursorInfo::TypeSouthEastPanning
:
68 return ui::kCursorSouthEastPanning
;
69 case WebCursorInfo::TypeSouthWestPanning
:
70 return ui::kCursorSouthWestPanning
;
71 case WebCursorInfo::TypeWestPanning
:
72 return ui::kCursorWestPanning
;
73 case WebCursorInfo::TypeMove
:
74 return ui::kCursorMove
;
75 case WebCursorInfo::TypeVerticalText
:
76 return ui::kCursorVerticalText
;
77 case WebCursorInfo::TypeCell
:
78 return ui::kCursorCell
;
79 case WebCursorInfo::TypeContextMenu
:
80 return ui::kCursorContextMenu
;
81 case WebCursorInfo::TypeAlias
:
82 return ui::kCursorAlias
;
83 case WebCursorInfo::TypeProgress
:
84 return ui::kCursorProgress
;
85 case WebCursorInfo::TypeNoDrop
:
86 return ui::kCursorNoDrop
;
87 case WebCursorInfo::TypeCopy
:
88 return ui::kCursorCopy
;
89 case WebCursorInfo::TypeNone
:
90 return ui::kCursorNone
;
91 case WebCursorInfo::TypeNotAllowed
:
92 return ui::kCursorNotAllowed
;
93 case WebCursorInfo::TypeZoomIn
:
94 return ui::kCursorZoomIn
;
95 case WebCursorInfo::TypeZoomOut
:
96 return ui::kCursorZoomOut
;
97 case WebCursorInfo::TypeGrab
:
98 return ui::kCursorGrab
;
99 case WebCursorInfo::TypeGrabbing
:
100 return ui::kCursorGrabbing
;
101 case WebCursorInfo::TypeCustom
: {
102 ui::Cursor
cursor(ui::kCursorCustom
);
103 cursor
.SetPlatformCursor(GetPlatformCursor());
108 return gfx::kNullCursor
;