| Index: chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm
|
| diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm
|
| index f1c67b185b18d0f0de67e5646164eaf0d8c0af80..147a7981c860f5ea1af50673f457dd5a8d7b457e 100644
|
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm
|
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm
|
| @@ -20,13 +20,6 @@ using bookmarks::BookmarkNodeData;
|
|
|
| NSString* kBookmarkButtonDragType = @"com.google.chrome.BookmarkButtonDrag";
|
|
|
| -@interface BookmarkFolderTarget()
|
| -// Copies the given bookmark node to the given pasteboard, declaring appropriate
|
| -// types (to paste a URL with a title).
|
| -- (void)copyBookmarkNode:(const BookmarkNode*)node
|
| - toDragPasteboard:(NSPasteboard*)pboard;
|
| -@end
|
| -
|
| @implementation BookmarkFolderTarget
|
|
|
| - (id)initWithController:(id<BookmarkButtonControllerProtocol>)controller
|
| @@ -91,42 +84,26 @@ NSString* kBookmarkButtonDragType = @"com.google.chrome.BookmarkButtonDrag";
|
| [controller_ addNewFolderControllerWithParentButton:sender];
|
| }
|
|
|
| -- (void)copyBookmarkNode:(const BookmarkNode*)node
|
| - toDragPasteboard:(NSPasteboard*)pboard {
|
| - if (!node) {
|
| - NOTREACHED();
|
| - return;
|
| - }
|
| +- (NSPasteboardItem*)pasteboardItemForDragOfButton:(BookmarkButton*)button {
|
| + const BookmarkNode* node = [button bookmarkNode];
|
| + DCHECK(node);
|
|
|
| + NSPasteboardItem* item = nil;
|
| if (node->is_folder()) {
|
| // TODO(viettrungluu): I'm not sure what we should do, so just declare the
|
| // "additional" types we're given for now. Maybe we want to add a list of
|
| // URLs? Would we then have to recurse if there were subfolders?
|
| - // In the meanwhile, we *must* set it to a known state.
|
| - [pboard clearContents];
|
| + item = [[[NSPasteboardItem alloc] init] autorelease];
|
| } else {
|
| BookmarkNodeData data(node);
|
| data.SetOriginatingProfilePath(profile_->GetPath());
|
| - data.WriteToClipboard(ui::CLIPBOARD_TYPE_DRAG);
|
| + item = PasteboardItemFromBookmarks(data.elements, profile_->GetPath());
|
| }
|
| -}
|
|
|
| -- (void)fillPasteboard:(NSPasteboard*)pboard
|
| - forDragOfButton:(BookmarkButton*)button {
|
| - if (const BookmarkNode* node = [button bookmarkNode]) {
|
| - // Put the bookmark information into the pasteboard, and then write our own
|
| - // data for
|
| - // |ui::ClipboardUtil::UTIForPasteboardType(kBookmarkButtonDragType)|.
|
| - [self copyBookmarkNode:node toDragPasteboard:pboard];
|
| - [pboard addTypes:@[ ui::ClipboardUtil::UTIForPasteboardType(
|
| - kBookmarkButtonDragType) ]
|
| - owner:nil];
|
| - [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)]
|
| - forType:ui::ClipboardUtil::UTIForPasteboardType(
|
| - kBookmarkButtonDragType)];
|
| - } else {
|
| - NOTREACHED();
|
| - }
|
| + [item
|
| + setData:[NSData dataWithBytes:&button length:sizeof(button)]
|
| + forType:ui::ClipboardUtil::UTIForPasteboardType(kBookmarkButtonDragType)];
|
| + return item;
|
| }
|
|
|
| @end
|
|
|