summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor_aura.cc
blob: 4510e96fa98f69ef3d275511cd32236bfa856273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/glue/webcursor.h"

#include "base/logging.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "ui/base/cursor/cursor.h"

using WebKit::WebCursorInfo;

gfx::NativeCursor WebCursor::GetNativeCursor() {
  switch (type_) {
    case WebCursorInfo::TypePointer:
      return ui::kCursorPointer;
    case WebCursorInfo::TypeCross:
      return ui::kCursorCross;
    case WebCursorInfo::TypeHand:
      return ui::kCursorHand;
    case WebCursorInfo::TypeIBeam:
      return ui::kCursorIBeam;
    case WebCursorInfo::TypeWait:
      return ui::kCursorWait;
    case WebCursorInfo::TypeHelp:
      return ui::kCursorHelp;
    case WebCursorInfo::TypeEastResize:
      return ui::kCursorEastResize;
    case WebCursorInfo::TypeNorthResize:
      return ui::kCursorNorthResize;
    case WebCursorInfo::TypeNorthEastResize:
      return ui::kCursorNorthEastResize;
    case WebCursorInfo::TypeNorthWestResize:
      return ui::kCursorNorthWestResize;
    case WebCursorInfo::TypeSouthResize:
      return ui::kCursorSouthResize;
    case WebCursorInfo::TypeSouthEastResize:
      return ui::kCursorSouthEastResize;
    case WebCursorInfo::TypeSouthWestResize:
      return ui::kCursorSouthWestResize;
    case WebCursorInfo::TypeWestResize:
      return ui::kCursorWestResize;
    case WebCursorInfo::TypeNorthSouthResize:
      return ui::kCursorNorthSouthResize;
    case WebCursorInfo::TypeEastWestResize:
      return ui::kCursorEastWestResize;
    case WebCursorInfo::TypeNorthEastSouthWestResize:
      return ui::kCursorNorthEastSouthWestResize;
    case WebCursorInfo::TypeNorthWestSouthEastResize:
      return ui::kCursorNorthWestSouthEastResize;
    case WebCursorInfo::TypeColumnResize:
      return ui::kCursorColumnResize;
    case WebCursorInfo::TypeRowResize:
      return ui::kCursorRowResize;
    case WebCursorInfo::TypeMiddlePanning:
      return ui::kCursorMiddlePanning;
    case WebCursorInfo::TypeEastPanning:
      return ui::kCursorEastPanning;
    case WebCursorInfo::TypeNorthPanning:
      return ui::kCursorNorthPanning;
    case WebCursorInfo::TypeNorthEastPanning:
      return ui::kCursorNorthEastPanning;
    case WebCursorInfo::TypeNorthWestPanning:
      return ui::kCursorNorthWestPanning;
    case WebCursorInfo::TypeSouthPanning:
      return ui::kCursorSouthPanning;
    case WebCursorInfo::TypeSouthEastPanning:
      return ui::kCursorSouthEastPanning;
    case WebCursorInfo::TypeSouthWestPanning:
      return ui::kCursorSouthWestPanning;
    case WebCursorInfo::TypeWestPanning:
      return ui::kCursorWestPanning;
    case WebCursorInfo::TypeMove:
      return ui::kCursorMove;
    case WebCursorInfo::TypeVerticalText:
      return ui::kCursorVerticalText;
    case WebCursorInfo::TypeCell:
      return ui::kCursorCell;
    case WebCursorInfo::TypeContextMenu:
      return ui::kCursorContextMenu;
    case WebCursorInfo::TypeAlias:
      return ui::kCursorAlias;
    case WebCursorInfo::TypeProgress:
      return ui::kCursorProgress;
    case WebCursorInfo::TypeNoDrop:
      return ui::kCursorNoDrop;
    case WebCursorInfo::TypeCopy:
      return ui::kCursorCopy;
    case WebCursorInfo::TypeNone:
      return ui::kCursorNone;
    case WebCursorInfo::TypeNotAllowed:
      return ui::kCursorNotAllowed;
    case WebCursorInfo::TypeZoomIn:
      return ui::kCursorZoomIn;
    case WebCursorInfo::TypeZoomOut:
      return ui::kCursorZoomOut;
    case WebCursorInfo::TypeGrab:
      return ui::kCursorGrab;
    case WebCursorInfo::TypeGrabbing:
      return ui::kCursorGrabbing;
    case WebCursorInfo::TypeCustom: {
      ui::Cursor cursor(ui::kCursorCustom);
      cursor.SetPlatformCursor(GetPlatformCursor());
      return cursor;
    }
    default:
      NOTREACHED();
      return gfx::kNullCursor;
  }
}