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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm

Issue 2014733003: Removing parsing of text from pasteboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: splitting calls in two variations, to discass Created 4 years, 6 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
OLDNEW
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/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // makes things more of a pain but there should be no excuse for laziness. 54 // makes things more of a pain but there should be no excuse for laziness.
55 // http://crbug.com/35966 55 // http://crbug.com/35966
56 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { 56 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info {
57 inDrag_ = YES; 57 inDrag_ = YES;
58 if (![[self controller] draggingAllowed:info]) 58 if (![[self controller] draggingAllowed:info])
59 return NSDragOperationNone; 59 return NSDragOperationNone;
60 if ([[info draggingPasteboard] 60 if ([[info draggingPasteboard]
61 dataForType:ui::ClipboardUtil::UTIForPasteboardType( 61 dataForType:ui::ClipboardUtil::UTIForPasteboardType(
62 kBookmarkButtonDragType)] || 62 kBookmarkButtonDragType)] ||
63 bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) || 63 bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
64 [[info draggingPasteboard] containsURLData]) { 64 [[info draggingPasteboard] containsURLDataInTypeOrText]) {
65 // Find the position of the drop indicator. 65 // Find the position of the drop indicator.
66 BOOL showIt = [[self controller] 66 BOOL showIt = [[self controller]
67 shouldShowIndicatorShownForPoint:[info draggingLocation]]; 67 shouldShowIndicatorShownForPoint:[info draggingLocation]];
68 if (!showIt) { 68 if (!showIt) {
69 [self setDropIndicatorShown:NO]; 69 [self setDropIndicatorShown:NO];
70 } else { 70 } else {
71 [self setDropIndicatorShown:YES]; 71 [self setDropIndicatorShown:YES];
72 72
73 CGFloat y = [[self controller] 73 CGFloat y = [[self controller]
74 indicatorPosForDragToPoint:[info draggingLocation]]; 74 indicatorPosForDragToPoint:[info draggingLocation]];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return YES; 124 return YES;
125 } 125 }
126 126
127 // This code is practically identical to the same function in BookmarkBarView 127 // This code is practically identical to the same function in BookmarkBarView
128 // with the only difference being how the controller is retrieved. 128 // with the only difference being how the controller is retrieved.
129 // TODO(mrossetti,jrg): http://crbug.com/35966 129 // TODO(mrossetti,jrg): http://crbug.com/35966
130 // Implement NSDraggingDestination protocol method 130 // Implement NSDraggingDestination protocol method
131 // performDragOperation: for URLs. 131 // performDragOperation: for URLs.
132 - (BOOL)performDragOperationForURL:(id<NSDraggingInfo>)info { 132 - (BOOL)performDragOperationForURL:(id<NSDraggingInfo>)info {
133 NSPasteboard* pboard = [info draggingPasteboard]; 133 NSPasteboard* pboard = [info draggingPasteboard];
134 DCHECK([pboard containsURLData]); 134 DCHECK([pboard containsURLDataInTypeOrText]);
135 135
136 NSArray* urls = nil; 136 NSArray* urls = nil;
137 NSArray* titles = nil; 137 NSArray* titles = nil;
138 [pboard getURLs:&urls andTitles:&titles convertingFilenames:YES]; 138 [pboard getURLsFromTypeOrText:&urls
139 andTitles:&titles
140 convertingFilenames:YES];
139 141
140 return [[self controller] addURLs:urls 142 return [[self controller] addURLs:urls
141 withTitles:titles 143 withTitles:titles
142 at:[info draggingLocation]]; 144 at:[info draggingLocation]];
143 } 145 }
144 146
145 // This code is practically identical to the same function in BookmarkBarView 147 // This code is practically identical to the same function in BookmarkBarView
146 // with the only difference being how the controller is retrieved. 148 // with the only difference being how the controller is retrieved.
147 // http://crbug.com/35966 149 // http://crbug.com/35966
148 // Implement NSDraggingDestination protocol method 150 // Implement NSDraggingDestination protocol method
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 182 }
181 183
182 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info { 184 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info {
183 if ([[self controller] dragBookmarkData:info]) 185 if ([[self controller] dragBookmarkData:info])
184 return YES; 186 return YES;
185 NSPasteboard* pboard = [info draggingPasteboard]; 187 NSPasteboard* pboard = [info draggingPasteboard];
186 if ([pboard dataForType:ui::ClipboardUtil::UTIForPasteboardType( 188 if ([pboard dataForType:ui::ClipboardUtil::UTIForPasteboardType(
187 kBookmarkButtonDragType)] && 189 kBookmarkButtonDragType)] &&
188 [self performDragOperationForBookmarkButton:info]) 190 [self performDragOperationForBookmarkButton:info])
189 return YES; 191 return YES;
190 if ([pboard containsURLData] && [self performDragOperationForURL:info]) 192 if ([pboard containsURLDataInTypeOrText] &&
193 [self performDragOperationForURL:info])
191 return YES; 194 return YES;
192 return NO; 195 return NO;
193 } 196 }
194 197
195 - (void)setDropIndicatorShown:(BOOL)flag { 198 - (void)setDropIndicatorShown:(BOOL)flag {
196 if (dropIndicatorShown_ == flag) 199 if (dropIndicatorShown_ == flag)
197 return; 200 return;
198 201
199 dropIndicatorShown_ = flag; 202 dropIndicatorShown_ = flag;
200 if (dropIndicatorShown_) { 203 if (dropIndicatorShown_) {
201 NSRect frame = NSInsetRect([self bounds], 4, 0); 204 NSRect frame = NSInsetRect([self bounds], 4, 0);
202 frame.size.height = 1; 205 frame.size.height = 1;
203 dropIndicator_.reset([[NSBox alloc] initWithFrame:frame]); 206 dropIndicator_.reset([[NSBox alloc] initWithFrame:frame]);
204 [dropIndicator_ setBoxType:NSBoxSeparator]; 207 [dropIndicator_ setBoxType:NSBoxSeparator];
205 [dropIndicator_ setBorderType:NSLineBorder]; 208 [dropIndicator_ setBorderType:NSLineBorder];
206 [dropIndicator_ setAlphaValue:0.85]; 209 [dropIndicator_ setAlphaValue:0.85];
207 [self addSubview:dropIndicator_]; 210 [self addSubview:dropIndicator_];
208 } else { 211 } else {
209 [dropIndicator_ removeFromSuperview]; 212 [dropIndicator_ removeFromSuperview];
210 dropIndicator_.reset(); 213 dropIndicator_.reset();
211 } 214 }
212 } 215 }
213 216
214 @end 217 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698