Chromium Code Reviews| 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 // Mac WebKit uses this type, declared in | |
| 13 // WebKit/mac/History/WebURLsWithTitles.h. | |
| 14 NSString* const kCrWebURLsWithTitlesPboardType = | |
|
Mark Mentovai
2012/03/12 23:37:35
If this only needs to be local to its translation
Nico
2012/03/12 23:43:39
Done.
| |
| 15 @"WebURLsWithTitlesPboardType"; | |
| 16 | |
| 12 @interface URLDropTargetHandler(Private) | 17 @interface URLDropTargetHandler(Private) |
| 13 | 18 |
| 14 // Gets the appropriate drag operation given the |NSDraggingInfo|. | 19 // Gets the appropriate drag operation given the |NSDraggingInfo|. |
| 15 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; | 20 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; |
| 16 | 21 |
| 17 // Tell the window controller to hide the drop indicator. | 22 // Tell the window controller to hide the drop indicator. |
| 18 - (void)hideIndicator; | 23 - (void)hideIndicator; |
| 19 | 24 |
| 20 @end // @interface URLDropTargetHandler(Private) | 25 @end // @interface URLDropTargetHandler(Private) |
| 21 | 26 |
| 22 @implementation URLDropTargetHandler | 27 @implementation URLDropTargetHandler |
| 23 | 28 |
| 24 + (NSArray*)handledDragTypes { | 29 + (NSArray*)handledDragTypes { |
| 25 return [NSArray arrayWithObjects:kWebURLsWithTitlesPboardType, | 30 return [NSArray arrayWithObjects:kCrWebURLsWithTitlesPboardType, |
| 26 NSURLPboardType, | 31 NSURLPboardType, |
| 27 NSStringPboardType, | 32 NSStringPboardType, |
| 28 NSFilenamesPboardType, | 33 NSFilenamesPboardType, |
| 29 nil]; | 34 nil]; |
| 30 } | 35 } |
| 31 | 36 |
| 32 - (id)initWithView:(NSView<URLDropTarget>*)view { | 37 - (id)initWithView:(NSView<URLDropTarget>*)view { |
| 33 if ((self = [super init])) { | 38 if ((self = [super init])) { |
| 34 view_ = view; | 39 view_ = view; |
| 35 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; | 40 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 | 122 |
| 118 // Only allow the copy operation. | 123 // Only allow the copy operation. |
| 119 return [sender draggingSourceOperationMask] & NSDragOperationCopy; | 124 return [sender draggingSourceOperationMask] & NSDragOperationCopy; |
| 120 } | 125 } |
| 121 | 126 |
| 122 - (void)hideIndicator { | 127 - (void)hideIndicator { |
| 123 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; | 128 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; |
| 124 } | 129 } |
| 125 | 130 |
| 126 @end // @implementation URLDropTargetHandler(Private) | 131 @end // @implementation URLDropTargetHandler(Private) |
| OLD | NEW |