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 #if WEBKIT_USING_SKIA | 17 #if WEBKIT_USING_SKIA |
18 #include "skia/ext/skia_utils_mac.h" | 18 #include "skia/ext/skia_utils_mac.h" |
19 #endif | 19 #endif |
20 | 20 |
21 using WebKit::WebCursorInfo; | 21 using WebKit::WebCursorInfo; |
22 using WebKit::WebImage; | 22 using WebKit::WebImage; |
23 using WebKit::WebSize; | 23 using WebKit::WebSize; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // TODO: This image fetch can (and probably should) be serviced by the resource | 27 // TODO: This image fetch can (and probably should) be serviced by the resource |
28 // resource bundle instead of going through the image cache. | 28 // resource bundle instead of going through the image cache. |
29 NSCursor* LoadCursor(const char* name, int x, int y) { | 29 NSCursor* LoadCursor(const char* name, int x, int y) { |
30 NSString* file_name = [NSString stringWithUTF8String:name]; | 30 NSString* file_name = [NSString stringWithUTF8String:name]; |
31 DCHECK(file_name); | 31 DCHECK(file_name); |
32 NSImage* cursor_image = app::mac::GetCachedImageWithName(file_name); | 32 NSImage* cursor_image = gfx::GetCachedImageWithName(file_name); |
33 DCHECK(cursor_image); | 33 DCHECK(cursor_image); |
34 return [[[NSCursor alloc] initWithImage:cursor_image | 34 return [[[NSCursor alloc] initWithImage:cursor_image |
35 hotSpot:NSMakePoint(x, y)] autorelease]; | 35 hotSpot:NSMakePoint(x, y)] autorelease]; |
36 } | 36 } |
37 | 37 |
38 CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data, | 38 CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data, |
39 const gfx::Size& custom_size) { | 39 const gfx::Size& custom_size) { |
40 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color( | 40 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color( |
41 CGColorSpaceCreateDeviceRGB()); | 41 CGColorSpaceCreateDeviceRGB()); |
42 // This is safe since we're not going to draw into the context we're creating. | 42 // This is safe since we're not going to draw into the context we're creating. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 return true; | 405 return true; |
406 } | 406 } |
407 | 407 |
408 void WebCursor::CleanupPlatformData() { | 408 void WebCursor::CleanupPlatformData() { |
409 return; | 409 return; |
410 } | 410 } |
411 | 411 |
412 void WebCursor::CopyPlatformData(const WebCursor& other) { | 412 void WebCursor::CopyPlatformData(const WebCursor& other) { |
413 return; | 413 return; |
414 } | 414 } |
OLD | NEW |