OLD | NEW |
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 Loading... |
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 |
OLD | NEW |