OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/url_drop_target.h" | 5 #import "chrome/browser/cocoa/url_drop_target.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "third_party/mozilla/NSPasteboard+Utils.h" | 8 #import "third_party/mozilla/NSPasteboard+Utils.h" |
9 | 9 |
10 @interface URLDropTargetHandler(Private) | 10 @interface URLDropTargetHandler(Private) |
11 | 11 |
12 // Gets the appropriate drag operation given the |NSDraggingInfo|. | 12 // Gets the appropriate drag operation given the |NSDraggingInfo|. |
13 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; | 13 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; |
14 | 14 |
15 // Tell the window controller to hide the drop indicator. | 15 // Tell the window controller to hide the drop indicator. |
16 - (void)hideIndicator; | 16 - (void)hideIndicator; |
17 | 17 |
18 @end // @interface URLDropTargetHandler(Private) | 18 @end // @interface URLDropTargetHandler(Private) |
19 | 19 |
20 @implementation URLDropTargetHandler | 20 @implementation URLDropTargetHandler |
21 | 21 |
22 - (id)initWithView:(NSView*)view { | 22 - (id)initWithView:(NSView<URLDropTarget>*)view { |
23 if ((self = [super init])) { | 23 if ((self = [super init])) { |
24 view_ = view; | 24 view_ = view; |
25 [view_ registerForDraggedTypes: | 25 [view_ registerForDraggedTypes: |
26 [NSArray arrayWithObjects:kWebURLsWithTitlesPboardType, | 26 [NSArray arrayWithObjects:kWebURLsWithTitlesPboardType, |
27 NSURLPboardType, | 27 NSURLPboardType, |
28 NSStringPboardType, | 28 NSStringPboardType, |
29 NSFilenamesPboardType, | 29 NSFilenamesPboardType, |
30 nil]]; | 30 nil]]; |
31 } | 31 } |
32 return self; | 32 return self; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender { | 83 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender { |
84 // Only allow the copy operation. | 84 // Only allow the copy operation. |
85 return [sender draggingSourceOperationMask] & NSDragOperationCopy; | 85 return [sender draggingSourceOperationMask] & NSDragOperationCopy; |
86 } | 86 } |
87 | 87 |
88 - (void)hideIndicator { | 88 - (void)hideIndicator { |
89 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; | 89 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; |
90 } | 90 } |
91 | 91 |
92 @end // @implementation URLDropTargetHandler(Private) | 92 @end // @implementation URLDropTargetHandler(Private) |
OLD | NEW |