diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-01 21:03:32 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-01 21:03:32 +0000 |
commit | 235f0e34406ee87a0daaeeff2ff420e39ec03753 (patch) | |
tree | 36ce5d2db7dde38870aaaba17944403b9a913f44 /chrome/browser/cocoa/bookmark_bar_view.mm | |
parent | 4593566dcbfd8c2df5f86a4edffb0afb604f87de (diff) | |
download | chromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.zip chromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.tar.gz chromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.tar.bz2 |
Mac: allow bookmark bar buttons to be dragged as URLs.
TODO #1: dragging of folder buttons.
TODO #2: perhaps holding Option while dragging on the bookmark bar should force
the bookmark to be copied instead of moved.
BUG=17608, 28842
TEST=Make a bunch of (non-folder) bookmarks on the bookmark bar; try dragging these bookmark bar buttons to the desktop, to the web content area, to text boxes, to other browsers -- these should all do sensible things; make sure that dragging them around on the bookmark bar still rearranges them.
Review URL: http://codereview.chromium.org/434095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_view.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_view.mm | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_view.mm b/chrome/browser/cocoa/bookmark_bar_view.mm index 2b6d69c..fd7bbe8 100644 --- a/chrome/browser/cocoa/bookmark_bar_view.mm +++ b/chrome/browser/cocoa/bookmark_bar_view.mm @@ -99,8 +99,6 @@ // NSDraggingDestination methods - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { - if ([[info draggingPasteboard] containsURLData]) - return NSDragOperationCopy; if ([[info draggingPasteboard] dataForType:kBookmarkButtonDragType]) { NSData* data = [[info draggingPasteboard] dataForType:kBookmarkButtonDragType]; @@ -120,10 +118,13 @@ dropIndicatorPosition_ = x; [self setNeedsDisplay:YES]; } - } - return NSDragOperationMove; + return NSDragOperationMove; + } + // Fall through otherwise. } + if ([[info draggingPasteboard] containsURLData]) + return NSDragOperationCopy; return NSDragOperationNone; } @@ -191,14 +192,16 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)info { NSPasteboard* pboard = [info draggingPasteboard]; + if ([pboard dataForType:kBookmarkButtonDragType]) { + if ([self performDragOperationForBookmark:info]) + return YES; + // Fall through.... + } if ([pboard containsURLData]) { - return [self performDragOperationForURL:info]; - } else if ([pboard dataForType:kBookmarkButtonDragType]) { - return [self performDragOperationForBookmark:info]; - } else { - NOTREACHED() << "Unknown drop type onto bookmark bar."; - return NO; + if ([self performDragOperationForURL:info]) + return YES; } + return NO; } @end // @implementation BookmarkBarView |