Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm |
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm |
index b8931f24e3cc798f6c670a94ea00efa032eebcb3..5d487dc80a60010cde98496ed4baaeb743d7f462 100644 |
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm |
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm |
@@ -187,20 +187,19 @@ |
[data getBytes:&button length:sizeof(button)]; |
// If we're dragging from one profile to another, disallow moving (only |
- // allow copying). Note that we need to call |GetOriginalProfile()| to make |
- // sure that Incognito profiles are handled correctly. |
- NSWindow* source_window = [[button delegate] browserWindow]; |
- BrowserWindowController* source_window_controller = |
- [BrowserWindowController |
- browserWindowControllerForWindow:source_window]; |
- const Profile* source_profile = |
- [source_window_controller profile]->GetOriginalProfile(); |
- const Profile* target_profile = |
- [[self controller] bookmarkModel]->profile()->GetOriginalProfile(); |
+ // allow copying). Each profile has its own bookmark model, so one way to |
+ // check whether we are dragging across profiles is to see if the |
+ // |BookmarkNode| corresponding to |button| exists in this profile. If it |
+ // does, we're dragging within a profile; otherwise, we're dragging across |
+ // profiles. |
+ const BookmarkModel* const model = [[self controller] bookmarkModel]; |
+ const BookmarkNode* const source_node = [button bookmarkNode]; |
+ const BookmarkNode* const target_node = |
+ model->GetNodeByID(source_node->id()); |
BOOL copy = |
!([info draggingSourceOperationMask] & NSDragOperationMove) || |
- source_profile != target_profile; |
+ (source_node != target_node); |
doDrag = [[self controller] dragButton:button |
to:[info draggingLocation] |
copy:copy]; |