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

Side by Side Diff: content/common/cursors/webcursor_mac.mm

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tapted Created 4 years, 7 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
« no previous file with comments | « content/common/common.sb ('k') | content/common/sandbox_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/mac_util.h"
12 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
13 #include "base/mac/sdk_forward_declarations.h" 12 #include "base/mac/sdk_forward_declarations.h"
14 #include "content/app/resources/grit/content_resources.h" 13 #include "content/app/resources/grit/content_resources.h"
15 #include "content/public/common/content_client.h" 14 #include "content/public/common/content_client.h"
16 #include "skia/ext/skia_utils_mac.h" 15 #include "skia/ext/skia_utils_mac.h"
17 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 16 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
18 #include "third_party/WebKit/public/platform/WebSize.h" 17 #include "third_party/WebKit/public/platform/WebSize.h"
19 #include "ui/gfx/geometry/point_conversions.h" 18 #include "ui/gfx/geometry/point_conversions.h"
20 #include "ui/gfx/geometry/size_conversions.h" 19 #include "ui/gfx/geometry/size_conversions.h"
21 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 hotSpot:NSMakePoint(hotspot_x, 113 hotSpot:NSMakePoint(hotspot_x,
115 hotspot_y)] autorelease]; 114 hotspot_y)] autorelease];
116 } 115 }
117 116
118 // Gets a specified cursor from CoreCursor, falling back to loading it from the 117 // Gets a specified cursor from CoreCursor, falling back to loading it from the
119 // image cache if CoreCursor cannot provide it. 118 // image cache if CoreCursor cannot provide it.
120 NSCursor* GetCoreCursorWithFallback(CrCoreCursorType type, 119 NSCursor* GetCoreCursorWithFallback(CrCoreCursorType type,
121 int resource_id, 120 int resource_id,
122 int hotspot_x, 121 int hotspot_x,
123 int hotspot_y) { 122 int hotspot_y) {
124 if (base::mac::IsOSLionOrLater()) { 123 NSCursor* cursor = [CrCoreCursor cursorWithType:type];
125 NSCursor* cursor = [CrCoreCursor cursorWithType:type]; 124 if (cursor)
126 if (cursor) 125 return cursor;
127 return cursor;
128 }
129 126
130 return LoadCursor(resource_id, hotspot_x, hotspot_y); 127 return LoadCursor(resource_id, hotspot_x, hotspot_y);
131 } 128 }
132 129
133 NSCursor* CreateCustomCursor(const std::vector<char>& custom_data, 130 NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
134 const gfx::Size& custom_size, 131 const gfx::Size& custom_size,
135 float custom_scale, 132 float custom_scale,
136 const gfx::Point& hotspot) { 133 const gfx::Point& hotspot) {
137 // If the data is missing, leave the backing transparent. 134 // If the data is missing, leave the backing transparent.
138 void* data = NULL; 135 void* data = NULL;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 namespace content { 182 namespace content {
186 183
187 // Match Safari's cursor choices; see platform/mac/CursorMac.mm . 184 // Match Safari's cursor choices; see platform/mac/CursorMac.mm .
188 gfx::NativeCursor WebCursor::GetNativeCursor() { 185 gfx::NativeCursor WebCursor::GetNativeCursor() {
189 switch (type_) { 186 switch (type_) {
190 case WebCursorInfo::TypePointer: 187 case WebCursorInfo::TypePointer:
191 return [NSCursor arrowCursor]; 188 return [NSCursor arrowCursor];
192 case WebCursorInfo::TypeCross: 189 case WebCursorInfo::TypeCross:
193 return [NSCursor crosshairCursor]; 190 return [NSCursor crosshairCursor];
194 case WebCursorInfo::TypeHand: 191 case WebCursorInfo::TypeHand:
195 // If >= 10.7, the pointingHandCursor has a shadow so use it. Otherwise 192 return [NSCursor pointingHandCursor];
196 // use the custom one.
197 if (base::mac::IsOSLionOrLater())
198 return [NSCursor pointingHandCursor];
199 else
200 return LoadCursor(IDR_LINK_CURSOR, 6, 1);
201 case WebCursorInfo::TypeIBeam: 193 case WebCursorInfo::TypeIBeam:
202 return [NSCursor IBeamCursor]; 194 return [NSCursor IBeamCursor];
203 case WebCursorInfo::TypeWait: 195 case WebCursorInfo::TypeWait:
204 return GetCoreCursorWithFallback(kBusyButClickableCursor, 196 return GetCoreCursorWithFallback(kBusyButClickableCursor,
205 IDR_WAIT_CURSOR, 7, 7); 197 IDR_WAIT_CURSOR, 7, 7);
206 case WebCursorInfo::TypeHelp: 198 case WebCursorInfo::TypeHelp:
207 return GetCoreCursorWithFallback(kHelpCursor, 199 return GetCoreCursorWithFallback(kHelpCursor,
208 IDR_HELP_CURSOR, 8, 8); 200 IDR_HELP_CURSOR, 8, 8);
209 case WebCursorInfo::TypeEastResize: 201 case WebCursorInfo::TypeEastResize:
210 case WebCursorInfo::TypeEastPanning: 202 case WebCursorInfo::TypeEastPanning:
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 374
383 void WebCursor::CleanupPlatformData() { 375 void WebCursor::CleanupPlatformData() {
384 return; 376 return;
385 } 377 }
386 378
387 void WebCursor::CopyPlatformData(const WebCursor& other) { 379 void WebCursor::CopyPlatformData(const WebCursor& other) {
388 return; 380 return;
389 } 381 }
390 382
391 } // namespace content 383 } // namespace content
OLDNEW
« no previous file with comments | « content/common/common.sb ('k') | content/common/sandbox_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698