| OLD | NEW |
| 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 "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" | 5 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 kCrWebURLsWithTitlesPboardType, | 346 kCrWebURLsWithTitlesPboardType, |
| 347 NSURLPboardType, | 347 NSURLPboardType, |
| 348 nil]; | 348 nil]; |
| 349 return [pb availableTypeFromArray:availableTypes] != nil; | 349 return [pb availableTypeFromArray:availableTypes] != nil; |
| 350 } | 350 } |
| 351 | 351 |
| 352 NSImage* DragImageForBookmark(NSImage* favicon, const string16& title) { | 352 NSImage* DragImageForBookmark(NSImage* favicon, const string16& title) { |
| 353 // If no favicon, use a default. | 353 // If no favicon, use a default. |
| 354 if (!favicon) { | 354 if (!favicon) { |
| 355 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 355 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 356 favicon = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON); | 356 favicon = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 // If no title, just use icon. | 359 // If no title, just use icon. |
| 360 if (title.empty()) | 360 if (title.empty()) |
| 361 return favicon; | 361 return favicon; |
| 362 NSString* ns_title = base::SysUTF16ToNSString(title); | 362 NSString* ns_title = base::SysUTF16ToNSString(title); |
| 363 | 363 |
| 364 // Set the look of the title. | 364 // Set the look of the title. |
| 365 NSDictionary* attrs = | 365 NSDictionary* attrs = |
| 366 [NSDictionary dictionaryWithObject:[NSFont systemFontOfSize: | 366 [NSDictionary dictionaryWithObject:[NSFont systemFontOfSize: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 [window dragImage:drag_image | 431 [window dragImage:drag_image |
| 432 at:position | 432 at:position |
| 433 offset:NSZeroSize | 433 offset:NSZeroSize |
| 434 event:drag_event | 434 event:drag_event |
| 435 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] | 435 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] |
| 436 source:nil | 436 source:nil |
| 437 slideBack:YES]; | 437 slideBack:YES]; |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace bookmark_pasteboard_helper_mac | 440 } // namespace bookmark_pasteboard_helper_mac |
| OLD | NEW |