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

Unified Diff: third_party/mozilla/NSPasteboard+Utils.mm

Issue 2014733003: Removing parsing of text from pasteboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverting everything, except mac. Review mac. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mozilla/NSPasteboard+Utils.mm
diff --git a/third_party/mozilla/NSPasteboard+Utils.mm b/third_party/mozilla/NSPasteboard+Utils.mm
index 0af5c48361ed0bec9d6367b7dd84eae450299e5a..72b8927cd087c532fb0adc945fa9cd9a6f9a5cc6 100644
--- a/third_party/mozilla/NSPasteboard+Utils.mm
+++ b/third_party/mozilla/NSPasteboard+Utils.mm
@@ -80,7 +80,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
kCorePasteboardFlavorType_url,
kCorePasteboardFlavorType_urln,
nil]];
- return [self declareTypes:allTypes owner:newOwner];
+ return [self declareTypes:allTypes owner:newOwner];
}
//
@@ -173,8 +173,9 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
// is YES, then the function will attempt to convert filenames in the drag
// to file URLs.
- (void) getURLs:(NSArray**)outUrls
- andTitles:(NSArray**)outTitles
+ andTitles:(NSArray**)outTitles
convertingFilenames:(BOOL)convertFilenames
+ convertTextToURL:(BOOL)convertTextToURL
{
NSArray* types = [self types];
NSURL* urlFromNSURL = nil; // Used below in getting an URL from the NSURLPboardType.
@@ -231,7 +232,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
if (!title && [types containsObject:NSStringPboardType])
title = [self stringForType:NSStringPboardType];
*outTitles = [NSArray arrayWithObject:(title ? title : @"")];
- } else if ([types containsObject:NSStringPboardType]) {
+ } else if (convertTextToURL && [types containsObject:NSStringPboardType]) {
NSString* potentialURLString = [self cleanedStringWithPasteboardString:[self stringForType:NSStringPboardType]];
if ([potentialURLString isValidURI]) {
*outUrls = [NSArray arrayWithObject:potentialURLString];
@@ -261,7 +262,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
// NB: Does not consider our internal bookmark list format, because callers
// usually need to deal with this separately because it can include folders etc.
//
-- (BOOL) containsURLData
+- (BOOL) containsURLData:(BOOL)convertTextToURL
{
NSArray* types = [self types];
if ( [types containsObject:kWebURLsWithTitlesPboardType]
erikchen 2016/05/31 17:15:51 This formatting looks really odd to me. Are you co
@@ -269,7 +270,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
|| [types containsObject:NSFilenamesPboardType] )
return YES;
- if ([types containsObject:NSStringPboardType]) {
+ if (convertTextToURL && [types containsObject:NSStringPboardType]) {
// Trim whitespace off the ends and newlines out of the middle so we don't reject otherwise-valid URLs;
// we'll do another cleaning when we set the URLs and titles later, so this is safe.
NSString* potentialURLString = [self cleanedStringWithPasteboardString:[self stringForType:NSStringPboardType]];

Powered by Google App Engine
This is Rietveld 408576698