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

Side by Side Diff: chrome/browser/ui/cocoa/url_drop_target.mm

Issue 1855583002: Refactor more clipboard/bookmark logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp15_dnd
Patch Set: Comments from avi. Created 4 years, 8 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
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_pasteboard_helper_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/drag_util.h" 7 #include "chrome/browser/ui/cocoa/drag_util.h"
8 #import "third_party/mozilla/NSPasteboard+Utils.h" 8 #import "third_party/mozilla/NSPasteboard+Utils.h"
9 #include "ui/base/clipboard/clipboard_util_mac.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 namespace {
12
13 // Mac WebKit uses this type, declared in
14 // WebKit/mac/History/WebURLsWithTitles.h.
15 NSString* const kCrWebURLsWithTitlesPboardType =
16 @"WebURLsWithTitlesPboardType";
17
18 } // namespace
19
20 @interface URLDropTargetHandler(Private) 12 @interface URLDropTargetHandler(Private)
21 13
22 // Gets the appropriate drag operation given the |NSDraggingInfo|. 14 // Gets the appropriate drag operation given the |NSDraggingInfo|.
23 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender; 15 - (NSDragOperation)getDragOperation:(id<NSDraggingInfo>)sender;
24 16
25 // Tell the window controller to hide the drop indicator. 17 // Tell the window controller to hide the drop indicator.
26 - (void)hideIndicator; 18 - (void)hideIndicator;
27 19
28 @end // @interface URLDropTargetHandler(Private) 20 @end // @interface URLDropTargetHandler(Private)
29 21
30 @implementation URLDropTargetHandler 22 @implementation URLDropTargetHandler
31 23
32 + (NSArray*)handledDragTypes { 24 + (NSArray*)handledDragTypes {
33 return [NSArray arrayWithObjects:kCrWebURLsWithTitlesPboardType, 25 return @[
34 NSURLPboardType, 26 ui::ClipboardUtil::UTIForWebURLsAndTitles(), NSURLPboardType,
35 NSStringPboardType, 27 NSStringPboardType, NSFilenamesPboardType
36 NSFilenamesPboardType, 28 ];
37 nil];
38 } 29 }
39 30
40 - (id)initWithView:(NSView<URLDropTarget>*)view { 31 - (id)initWithView:(NSView<URLDropTarget>*)view {
41 if ((self = [super init])) { 32 if ((self = [super init])) {
42 view_ = view; 33 view_ = view;
43 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; 34 [view_ registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]];
44 } 35 }
45 return self; 36 return self;
46 } 37 }
47 38
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 116
126 // Only allow the copy operation. 117 // Only allow the copy operation.
127 return [sender draggingSourceOperationMask] & NSDragOperationCopy; 118 return [sender draggingSourceOperationMask] & NSDragOperationCopy;
128 } 119 }
129 120
130 - (void)hideIndicator { 121 - (void)hideIndicator {
131 [[view_ urlDropController] hideDropURLsIndicatorInView:view_]; 122 [[view_ urlDropController] hideDropURLsIndicatorInView:view_];
132 } 123 }
133 124
134 @end // @implementation URLDropTargetHandler(Private) 125 @end // @implementation URLDropTargetHandler(Private)
OLDNEW
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_pasteboard_helper_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698