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

Side by Side Diff: content/common/cursors/webcursor_aura.cc

Issue 2833163002: Change ui cursor identifiers to an enum class. (Closed)
Patch Set: OK, it can't be explicit for mac. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 "content/common/cursors/webcursor.h" 5 #include "content/common/cursors/webcursor.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 8 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
9 #include "ui/base/cursor/cursor.h" 9 #include "ui/base/cursor/cursor.h"
10 #include "ui/base/cursor/cursor_util.h" 10 #include "ui/base/cursor/cursor_util.h"
11 11
12 using blink::WebCursorInfo; 12 using blink::WebCursorInfo;
13 13
14 namespace content { 14 namespace content {
15 15
16 gfx::NativeCursor WebCursor::GetNativeCursor() { 16 gfx::NativeCursor WebCursor::GetNativeCursor() {
17 switch (type_) { 17 switch (type_) {
18 case WebCursorInfo::kTypePointer: 18 case WebCursorInfo::kTypePointer:
19 return ui::kCursorPointer; 19 return ui::CursorType::kPointer;
20 case WebCursorInfo::kTypeCross: 20 case WebCursorInfo::kTypeCross:
21 return ui::kCursorCross; 21 return ui::CursorType::kCross;
22 case WebCursorInfo::kTypeHand: 22 case WebCursorInfo::kTypeHand:
23 return ui::kCursorHand; 23 return ui::CursorType::kHand;
24 case WebCursorInfo::kTypeIBeam: 24 case WebCursorInfo::kTypeIBeam:
25 return ui::kCursorIBeam; 25 return ui::CursorType::kIBeam;
26 case WebCursorInfo::kTypeWait: 26 case WebCursorInfo::kTypeWait:
27 return ui::kCursorWait; 27 return ui::CursorType::kWait;
28 case WebCursorInfo::kTypeHelp: 28 case WebCursorInfo::kTypeHelp:
29 return ui::kCursorHelp; 29 return ui::CursorType::kHelp;
30 case WebCursorInfo::kTypeEastResize: 30 case WebCursorInfo::kTypeEastResize:
31 return ui::kCursorEastResize; 31 return ui::CursorType::kEastResize;
32 case WebCursorInfo::kTypeNorthResize: 32 case WebCursorInfo::kTypeNorthResize:
33 return ui::kCursorNorthResize; 33 return ui::CursorType::kNorthResize;
34 case WebCursorInfo::kTypeNorthEastResize: 34 case WebCursorInfo::kTypeNorthEastResize:
35 return ui::kCursorNorthEastResize; 35 return ui::CursorType::kNorthEastResize;
36 case WebCursorInfo::kTypeNorthWestResize: 36 case WebCursorInfo::kTypeNorthWestResize:
37 return ui::kCursorNorthWestResize; 37 return ui::CursorType::kNorthWestResize;
38 case WebCursorInfo::kTypeSouthResize: 38 case WebCursorInfo::kTypeSouthResize:
39 return ui::kCursorSouthResize; 39 return ui::CursorType::kSouthResize;
40 case WebCursorInfo::kTypeSouthEastResize: 40 case WebCursorInfo::kTypeSouthEastResize:
41 return ui::kCursorSouthEastResize; 41 return ui::CursorType::kSouthEastResize;
42 case WebCursorInfo::kTypeSouthWestResize: 42 case WebCursorInfo::kTypeSouthWestResize:
43 return ui::kCursorSouthWestResize; 43 return ui::CursorType::kSouthWestResize;
44 case WebCursorInfo::kTypeWestResize: 44 case WebCursorInfo::kTypeWestResize:
45 return ui::kCursorWestResize; 45 return ui::CursorType::kWestResize;
46 case WebCursorInfo::kTypeNorthSouthResize: 46 case WebCursorInfo::kTypeNorthSouthResize:
47 return ui::kCursorNorthSouthResize; 47 return ui::CursorType::kNorthSouthResize;
48 case WebCursorInfo::kTypeEastWestResize: 48 case WebCursorInfo::kTypeEastWestResize:
49 return ui::kCursorEastWestResize; 49 return ui::CursorType::kEastWestResize;
50 case WebCursorInfo::kTypeNorthEastSouthWestResize: 50 case WebCursorInfo::kTypeNorthEastSouthWestResize:
51 return ui::kCursorNorthEastSouthWestResize; 51 return ui::CursorType::kNorthEastSouthWestResize;
52 case WebCursorInfo::kTypeNorthWestSouthEastResize: 52 case WebCursorInfo::kTypeNorthWestSouthEastResize:
53 return ui::kCursorNorthWestSouthEastResize; 53 return ui::CursorType::kNorthWestSouthEastResize;
54 case WebCursorInfo::kTypeColumnResize: 54 case WebCursorInfo::kTypeColumnResize:
55 return ui::kCursorColumnResize; 55 return ui::CursorType::kColumnResize;
56 case WebCursorInfo::kTypeRowResize: 56 case WebCursorInfo::kTypeRowResize:
57 return ui::kCursorRowResize; 57 return ui::CursorType::kRowResize;
58 case WebCursorInfo::kTypeMiddlePanning: 58 case WebCursorInfo::kTypeMiddlePanning:
59 return ui::kCursorMiddlePanning; 59 return ui::CursorType::kMiddlePanning;
60 case WebCursorInfo::kTypeEastPanning: 60 case WebCursorInfo::kTypeEastPanning:
61 return ui::kCursorEastPanning; 61 return ui::CursorType::kEastPanning;
62 case WebCursorInfo::kTypeNorthPanning: 62 case WebCursorInfo::kTypeNorthPanning:
63 return ui::kCursorNorthPanning; 63 return ui::CursorType::kNorthPanning;
64 case WebCursorInfo::kTypeNorthEastPanning: 64 case WebCursorInfo::kTypeNorthEastPanning:
65 return ui::kCursorNorthEastPanning; 65 return ui::CursorType::kNorthEastPanning;
66 case WebCursorInfo::kTypeNorthWestPanning: 66 case WebCursorInfo::kTypeNorthWestPanning:
67 return ui::kCursorNorthWestPanning; 67 return ui::CursorType::kNorthWestPanning;
68 case WebCursorInfo::kTypeSouthPanning: 68 case WebCursorInfo::kTypeSouthPanning:
69 return ui::kCursorSouthPanning; 69 return ui::CursorType::kSouthPanning;
70 case WebCursorInfo::kTypeSouthEastPanning: 70 case WebCursorInfo::kTypeSouthEastPanning:
71 return ui::kCursorSouthEastPanning; 71 return ui::CursorType::kSouthEastPanning;
72 case WebCursorInfo::kTypeSouthWestPanning: 72 case WebCursorInfo::kTypeSouthWestPanning:
73 return ui::kCursorSouthWestPanning; 73 return ui::CursorType::kSouthWestPanning;
74 case WebCursorInfo::kTypeWestPanning: 74 case WebCursorInfo::kTypeWestPanning:
75 return ui::kCursorWestPanning; 75 return ui::CursorType::kWestPanning;
76 case WebCursorInfo::kTypeMove: 76 case WebCursorInfo::kTypeMove:
77 return ui::kCursorMove; 77 return ui::CursorType::kMove;
78 case WebCursorInfo::kTypeVerticalText: 78 case WebCursorInfo::kTypeVerticalText:
79 return ui::kCursorVerticalText; 79 return ui::CursorType::kVerticalText;
80 case WebCursorInfo::kTypeCell: 80 case WebCursorInfo::kTypeCell:
81 return ui::kCursorCell; 81 return ui::CursorType::kCell;
82 case WebCursorInfo::kTypeContextMenu: 82 case WebCursorInfo::kTypeContextMenu:
83 return ui::kCursorContextMenu; 83 return ui::CursorType::kContextMenu;
84 case WebCursorInfo::kTypeAlias: 84 case WebCursorInfo::kTypeAlias:
85 return ui::kCursorAlias; 85 return ui::CursorType::kAlias;
86 case WebCursorInfo::kTypeProgress: 86 case WebCursorInfo::kTypeProgress:
87 return ui::kCursorProgress; 87 return ui::CursorType::kProgress;
88 case WebCursorInfo::kTypeNoDrop: 88 case WebCursorInfo::kTypeNoDrop:
89 return ui::kCursorNoDrop; 89 return ui::CursorType::kNoDrop;
90 case WebCursorInfo::kTypeCopy: 90 case WebCursorInfo::kTypeCopy:
91 return ui::kCursorCopy; 91 return ui::CursorType::kCopy;
92 case WebCursorInfo::kTypeNone: 92 case WebCursorInfo::kTypeNone:
93 return ui::kCursorNone; 93 return ui::CursorType::kNone;
94 case WebCursorInfo::kTypeNotAllowed: 94 case WebCursorInfo::kTypeNotAllowed:
95 return ui::kCursorNotAllowed; 95 return ui::CursorType::kNotAllowed;
96 case WebCursorInfo::kTypeZoomIn: 96 case WebCursorInfo::kTypeZoomIn:
97 return ui::kCursorZoomIn; 97 return ui::CursorType::kZoomIn;
98 case WebCursorInfo::kTypeZoomOut: 98 case WebCursorInfo::kTypeZoomOut:
99 return ui::kCursorZoomOut; 99 return ui::CursorType::kZoomOut;
100 case WebCursorInfo::kTypeGrab: 100 case WebCursorInfo::kTypeGrab:
101 return ui::kCursorGrab; 101 return ui::CursorType::kGrab;
102 case WebCursorInfo::kTypeGrabbing: 102 case WebCursorInfo::kTypeGrabbing:
103 return ui::kCursorGrabbing; 103 return ui::CursorType::kGrabbing;
104 case WebCursorInfo::kTypeCustom: { 104 case WebCursorInfo::kTypeCustom: {
105 ui::Cursor cursor(ui::kCursorCustom); 105 ui::Cursor cursor(ui::CursorType::kCustom);
106 cursor.SetPlatformCursor(GetPlatformCursor()); 106 cursor.SetPlatformCursor(GetPlatformCursor());
107 return cursor; 107 return cursor;
108 } 108 }
109 default: 109 default:
110 NOTREACHED(); 110 NOTREACHED();
111 return gfx::kNullCursor; 111 return gfx::kNullCursor;
112 } 112 }
113 } 113 }
114 114
115 float WebCursor::GetCursorScaleFactor() { 115 float WebCursor::GetCursorScaleFactor() {
(...skipping 17 matching lines...) Expand all
133 void WebCursor::SetDisplayInfo(const display::Display& display) { 133 void WebCursor::SetDisplayInfo(const display::Display& display) {
134 if (device_scale_factor_ == display.device_scale_factor()) 134 if (device_scale_factor_ == display.device_scale_factor())
135 return; 135 return;
136 136
137 device_scale_factor_ = display.device_scale_factor(); 137 device_scale_factor_ = display.device_scale_factor();
138 CleanupPlatformData(); 138 CleanupPlatformData();
139 } 139 }
140 #endif 140 #endif
141 141
142 } // namespace content 142 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698