| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/webcursor.h" | 5 #include "webkit/glue/webcursor.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image | 104 NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image |
| 105 hotSpot:NSMakePoint(hotspot.x(), | 105 hotSpot:NSMakePoint(hotspot.x(), |
| 106 hotspot.y())]; | 106 hotspot.y())]; |
| 107 [cursor_image release]; | 107 [cursor_image release]; |
| 108 | 108 |
| 109 return [cursor autorelease]; | 109 return [cursor autorelease]; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace | 112 } // namespace |
| 113 | 113 |
| 114 // We're matching Safari's cursor choices; see platform/mac/CursorMac.mm | 114 // We're (mostly) matching Safari's cursor choices; see |
| 115 // platform/mac/CursorMac.mm . Note that Safari uses some magic in wkCursor to |
| 116 // access private system cursors. A sample implementation using the same |
| 117 // technique can be found attached to http://crbug.com/92892 . However, it's not |
| 118 // clear that accessing system cursors this way is enough of a gain to risk |
| 119 // using SPIs. Until the benefits more clearly outweigh the risks, API is all |
| 120 // that will be used. |
| 115 NSCursor* WebCursor::GetCursor() const { | 121 NSCursor* WebCursor::GetCursor() const { |
| 116 switch (type_) { | 122 switch (type_) { |
| 117 case WebCursorInfo::TypePointer: | 123 case WebCursorInfo::TypePointer: |
| 118 return [NSCursor arrowCursor]; | 124 return [NSCursor arrowCursor]; |
| 119 case WebCursorInfo::TypeCross: | 125 case WebCursorInfo::TypeCross: |
| 120 return [NSCursor crosshairCursor]; | 126 return [NSCursor crosshairCursor]; |
| 121 case WebCursorInfo::TypeHand: | 127 case WebCursorInfo::TypeHand: |
| 122 // If >= 10.7, the pointingHandCursor has a shadow so use it. Otherwise | 128 // If >= 10.7, the pointingHandCursor has a shadow so use it. Otherwise |
| 123 // use the custom one. | 129 // use the custom one. |
| 124 if (base::mac::IsOSLionOrLater()) | 130 if (base::mac::IsOSLionOrLater()) |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 return true; | 472 return true; |
| 467 } | 473 } |
| 468 | 474 |
| 469 void WebCursor::CleanupPlatformData() { | 475 void WebCursor::CleanupPlatformData() { |
| 470 return; | 476 return; |
| 471 } | 477 } |
| 472 | 478 |
| 473 void WebCursor::CopyPlatformData(const WebCursor& other) { | 479 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 474 return; | 480 return; |
| 475 } | 481 } |
| OLD | NEW |