| 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 "app/mac/nsimage_cache.h" | |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 12 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 15 #include "ui/gfx/mac/nsimage_cache.h" |
| 16 | 16 |
| 17 using WebKit::WebCursorInfo; | 17 using WebKit::WebCursorInfo; |
| 18 using WebKit::WebImage; | 18 using WebKit::WebImage; |
| 19 using WebKit::WebSize; | 19 using WebKit::WebSize; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // TODO: This image fetch can (and probably should) be serviced by the resource | 23 // TODO: This image fetch can (and probably should) be serviced by the resource |
| 24 // resource bundle instead of going through the image cache. | 24 // resource bundle instead of going through the image cache. |
| 25 NSCursor* LoadCursor(const char* name, int x, int y) { | 25 NSCursor* LoadCursor(const char* name, int x, int y) { |
| 26 NSString* file_name = [NSString stringWithUTF8String:name]; | 26 NSString* file_name = [NSString stringWithUTF8String:name]; |
| 27 DCHECK(file_name); | 27 DCHECK(file_name); |
| 28 NSImage* cursor_image = app::mac::GetCachedImageWithName(file_name); | 28 NSImage* cursor_image = gfx::GetCachedImageWithName(file_name); |
| 29 DCHECK(cursor_image); | 29 DCHECK(cursor_image); |
| 30 return [[[NSCursor alloc] initWithImage:cursor_image | 30 return [[[NSCursor alloc] initWithImage:cursor_image |
| 31 hotSpot:NSMakePoint(x, y)] autorelease]; | 31 hotSpot:NSMakePoint(x, y)] autorelease]; |
| 32 } | 32 } |
| 33 | 33 |
| 34 CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data, | 34 CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data, |
| 35 const gfx::Size& custom_size) { | 35 const gfx::Size& custom_size) { |
| 36 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color( | 36 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color( |
| 37 CGColorSpaceCreateDeviceRGB()); | 37 CGColorSpaceCreateDeviceRGB()); |
| 38 // This is safe since we're not going to draw into the context we're creating. | 38 // This is safe since we're not going to draw into the context we're creating. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return true; | 393 return true; |
| 394 } | 394 } |
| 395 | 395 |
| 396 void WebCursor::CleanupPlatformData() { | 396 void WebCursor::CleanupPlatformData() { |
| 397 return; | 397 return; |
| 398 } | 398 } |
| 399 | 399 |
| 400 void WebCursor::CopyPlatformData(const WebCursor& other) { | 400 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 401 return; | 401 return; |
| 402 } | 402 } |
| OLD | NEW |