Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm

Issue 8383026: [Mac] Don't crash when dragging and dropping bookmarks within a bookmarks folder. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" 7 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // If we're dragging from one profile to another, disallow moving (only 189 // If we're dragging from one profile to another, disallow moving (only
190 // allow copying). Note that we need to call |GetOriginalProfile()| to make 190 // allow copying). Note that we need to call |GetOriginalProfile()| to make
191 // sure that Incognito profiles are handled correctly. 191 // sure that Incognito profiles are handled correctly.
192 NSWindow* source_window = [[button delegate] browserWindow]; 192 NSWindow* source_window = [[button delegate] browserWindow];
193 BrowserWindowController* source_window_controller = 193 BrowserWindowController* source_window_controller =
194 [BrowserWindowController 194 [BrowserWindowController
195 browserWindowControllerForWindow:source_window]; 195 browserWindowControllerForWindow:source_window];
196 const Profile* source_profile = 196 const Profile* source_profile =
197 [source_window_controller profile]->GetOriginalProfile(); 197 [source_window_controller profile]->GetOriginalProfile();
198 const Profile* target_profile = 198 const Profile* target_profile =
199 [controller_ bookmarkModel]->profile()->GetOriginalProfile(); 199 [[self controller] bookmarkModel]->profile()->GetOriginalProfile();
200 200
201 BOOL copy = 201 BOOL copy =
202 !([info draggingSourceOperationMask] & NSDragOperationMove) || 202 !([info draggingSourceOperationMask] & NSDragOperationMove) ||
203 source_profile != target_profile; 203 source_profile != target_profile;
204 doDrag = [[self controller] dragButton:button 204 doDrag = [[self controller] dragButton:button
205 to:[info draggingLocation] 205 to:[info draggingLocation]
206 copy:copy]; 206 copy:copy];
207 UserMetrics::RecordAction(UserMetricsAction("BookmarkBarFolder_DragEnd")); 207 UserMetrics::RecordAction(UserMetricsAction("BookmarkBarFolder_DragEnd"));
208 } 208 }
209 return doDrag; 209 return doDrag;
210 } 210 }
211 211
212 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info { 212 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info {
213 if ([[self controller] dragBookmarkData:info]) 213 if ([[self controller] dragBookmarkData:info])
214 return YES; 214 return YES;
215 NSPasteboard* pboard = [info draggingPasteboard]; 215 NSPasteboard* pboard = [info draggingPasteboard];
216 if ([pboard dataForType:kBookmarkButtonDragType] && 216 if ([pboard dataForType:kBookmarkButtonDragType] &&
217 [self performDragOperationForBookmarkButton:info]) 217 [self performDragOperationForBookmarkButton:info])
218 return YES; 218 return YES;
219 if ([pboard containsURLData] && [self performDragOperationForURL:info]) 219 if ([pboard containsURLData] && [self performDragOperationForURL:info])
220 return YES; 220 return YES;
221 return NO; 221 return NO;
222 } 222 }
223 223
224 @end 224 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698