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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.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_view_cocoa.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #import "chrome/browser/themes/theme_properties.h" 8 #import "chrome/browser/themes/theme_properties.h"
9 #import "chrome/browser/themes/theme_service.h" 9 #import "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 // NSDraggingDestination methods 138 // NSDraggingDestination methods
139 139
140 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { 140 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info {
141 if (![controller_ draggingAllowed:info]) 141 if (![controller_ draggingAllowed:info])
142 return NSDragOperationNone; 142 return NSDragOperationNone;
143 if ([[info draggingPasteboard] 143 if ([[info draggingPasteboard]
144 dataForType:ui::ClipboardUtil::UTIForPasteboardType( 144 dataForType:ui::ClipboardUtil::UTIForPasteboardType(
145 kBookmarkButtonDragType)] || 145 kBookmarkButtonDragType)] ||
146 bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) || 146 bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
147 [[info draggingPasteboard] containsURLData]) { 147 [[info draggingPasteboard] containsURLDataInTypeOrText]) {
148 // We only show the drop indicator if we're not in a position to 148 // We only show the drop indicator if we're not in a position to
149 // perform a hover-open since it doesn't make sense to do both. 149 // perform a hover-open since it doesn't make sense to do both.
150 BOOL showIt = [controller_ shouldShowIndicatorShownForPoint: 150 BOOL showIt = [controller_ shouldShowIndicatorShownForPoint:
151 [info draggingLocation]]; 151 [info draggingLocation]];
152 if (!showIt) { 152 if (!showIt) {
153 if (dropIndicatorShown_) { 153 if (dropIndicatorShown_) {
154 dropIndicatorShown_ = NO; 154 dropIndicatorShown_ = NO;
155 [self dropIndicatorChanged]; 155 [self dropIndicatorChanged];
156 } 156 }
157 } else { 157 } else {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 - (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)info { 207 - (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)info {
208 return YES; 208 return YES;
209 } 209 }
210 210
211 // Implement NSDraggingDestination protocol method 211 // Implement NSDraggingDestination protocol method
212 // performDragOperation: for URLs. 212 // performDragOperation: for URLs.
213 - (BOOL)performDragOperationForURL:(id<NSDraggingInfo>)info { 213 - (BOOL)performDragOperationForURL:(id<NSDraggingInfo>)info {
214 NSPasteboard* pboard = [info draggingPasteboard]; 214 NSPasteboard* pboard = [info draggingPasteboard];
215 DCHECK([pboard containsURLData]); 215 DCHECK([pboard containsURLDataInTypeOrText]);
216 216
217 NSArray* urls = nil; 217 NSArray* urls = nil;
218 NSArray* titles = nil; 218 NSArray* titles = nil;
219 [pboard getURLs:&urls andTitles:&titles convertingFilenames:YES]; 219 [pboard getURLsFromTypeOrText:&urls
220 andTitles:&titles
221 convertingFilenames:YES];
220 222
221 return [controller_ addURLs:urls 223 return [controller_ addURLs:urls
222 withTitles:titles 224 withTitles:titles
223 at:[info draggingLocation]]; 225 at:[info draggingLocation]];
224 } 226 }
225 227
226 // Implement NSDraggingDestination protocol method 228 // Implement NSDraggingDestination protocol method
227 // performDragOperation: for bookmark buttons. 229 // performDragOperation: for bookmark buttons.
228 - (BOOL)performDragOperationForBookmarkButton:(id<NSDraggingInfo>)info { 230 - (BOOL)performDragOperationForBookmarkButton:(id<NSDraggingInfo>)info {
229 BOOL rtn = NO; 231 BOOL rtn = NO;
(...skipping 30 matching lines...) Expand all
260 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info { 262 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info {
261 if ([controller_ dragBookmarkData:info]) 263 if ([controller_ dragBookmarkData:info])
262 return YES; 264 return YES;
263 NSPasteboard* pboard = [info draggingPasteboard]; 265 NSPasteboard* pboard = [info draggingPasteboard];
264 if ([pboard dataForType:ui::ClipboardUtil::UTIForPasteboardType( 266 if ([pboard dataForType:ui::ClipboardUtil::UTIForPasteboardType(
265 kBookmarkButtonDragType)]) { 267 kBookmarkButtonDragType)]) {
266 if ([self performDragOperationForBookmarkButton:info]) 268 if ([self performDragOperationForBookmarkButton:info])
267 return YES; 269 return YES;
268 // Fall through.... 270 // Fall through....
269 } 271 }
270 if ([pboard containsURLData]) { 272 if ([pboard containsURLDataInTypeOrText]) {
271 if ([self performDragOperationForURL:info]) 273 if ([self performDragOperationForURL:info])
272 return YES; 274 return YES;
273 } 275 }
274 return NO; 276 return NO;
275 } 277 }
276 278
277 - (NSMenu*)menu { 279 - (NSMenu*)menu {
278 return [[controller_ menuController] menuForBookmarkBar]; 280 return [[controller_ menuController] menuForBookmarkBar];
279 } 281 }
280 282
(...skipping 15 matching lines...) Expand all
296 298
297 @end // @implementation BookmarkBarTextField 299 @end // @implementation BookmarkBarTextField
298 300
299 @implementation BookmarkBarItemContainer 301 @implementation BookmarkBarItemContainer
300 302
301 - (NSMenu*)menu { 303 - (NSMenu*)menu {
302 return [barView_ menu]; 304 return [barView_ menu];
303 } 305 }
304 306
305 @end // @implementation BookmarkBarItemContainer 307 @end // @implementation BookmarkBarItemContainer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698