| 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/url_drop_target.h" | 5 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "chrome/browser/ui/cocoa/drag_util.h" | 8 #include "chrome/browser/ui/cocoa/drag_util.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #import "third_party/mozilla/NSPasteboard+Utils.h" | 10 #import "third_party/mozilla/NSPasteboard+Utils.h" |
| 11 | 11 |
| 12 namespace { |
| 13 |
| 14 // Mac WebKit uses this type, declared in |
| 15 // WebKit/mac/History/WebURLsWithTitles.h. |
| 16 NSString* const kCrWebURLsWithTitlesPboardType = |
| 17 @"WebURLsWithTitlesPboardType"; |
| 18 |
| 19 } // namespace |
| 20 |
| 12 @interface URLDropTargetHandler(Private) | 21 @interface URLDropTargetHandler(Private) |
| 13 | 22 |
| 14 // Gets the appropriate drag operation given the |NSDraggingInfo|. | 23 // Gets the appropriate drag operation given the |NSDraggingInfo|. |
| 15 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; | 24 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; |
| 16 | 25 |
| 17 // Tell the window controller to hide the drop indicator. | 26 // Tell the window controller to hide the drop indicator. |
| 18 - (void)hideIndicator; | 27 - (void)hideIndicator; |
| 19 | 28 |
| 20 @end // @interface URLDropTargetHandler(Private) | 29 @end // @interface URLDropTargetHandler(Private) |
| 21 | 30 |
| 22 @implementation URLDropTargetHandler | 31 @implementation URLDropTargetHandler |
| 23 | 32 |
| 24 + (NSArray*)handledDragTypes { | 33 + (NSArray*)handledDragTypes { |
| 25 return [NSArray arrayWithObjects:kWebURLsWithTitlesPboardType, | 34 return [NSArray arrayWithObjects:kCrWebURLsWithTitlesPboardType, |
| 26 NSURLPboardType, | 35 NSURLPboardType, |
| 27 NSStringPboardType, | 36 NSStringPboardType, |
| 28 NSFilenamesPboardType, | 37 NSFilenamesPboardType, |
| 29 nil]; | 38 nil]; |
| 30 } | 39 } |
| 31 | 40 |
| 32 - (id)initWithView:(NSView<URLDropTarget>*)view { | 41 - (id)initWithView:(NSView<URLDropTarget>*)view { |
| 33 if ((self = [super init])) { | 42 if ((self = [super init])) { |
| 34 view_ = view; | 43 view_ = view; |
| 35 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; | 44 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 126 |
| 118 // Only allow the copy operation. | 127 // Only allow the copy operation. |
| 119 return [sender draggingSourceOperationMask] & NSDragOperationCopy; | 128 return [sender draggingSourceOperationMask] & NSDragOperationCopy; |
| 120 } | 129 } |
| 121 | 130 |
| 122 - (void)hideIndicator { | 131 - (void)hideIndicator { |
| 123 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; | 132 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; |
| 124 } | 133 } |
| 125 | 134 |
| 126 @end // @implementation URLDropTargetHandler(Private) | 135 @end // @implementation URLDropTargetHandler(Private) |
| OLD | NEW |