| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // 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" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/nsimage_cache_mac.h" | |
| 12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
| 14 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebSize.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 nsimage_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 = nsimage_cache::ImageNamed(file_name); | 28 NSImage* cursor_image = app::mac::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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void WebCursor::CleanupPlatformData() { | 383 void WebCursor::CleanupPlatformData() { |
| 384 return; | 384 return; |
| 385 } | 385 } |
| 386 | 386 |
| 387 void WebCursor::CopyPlatformData(const WebCursor& other) { | 387 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 388 return; | 388 return; |
| 389 } | 389 } |
| OLD | NEW |