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

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: Compilation fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/mozilla/NSPasteboard+Utils.h ('k') | third_party/mozilla/README.chromium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..84802d445b49818988e41cfb65fc4c7dc593c593 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
+ convertingTextToURL:(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,15 +262,15 @@ 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) containsURLDataConvertingTextToURL:(BOOL)convertTextToURL
{
NSArray* types = [self types];
- if ( [types containsObject:kWebURLsWithTitlesPboardType]
- || [types containsObject:NSURLPboardType]
- || [types containsObject:NSFilenamesPboardType] )
+ if ([types containsObject:kWebURLsWithTitlesPboardType] ||
+ [types containsObject:NSURLPboardType] ||
+ [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]];
« no previous file with comments | « third_party/mozilla/NSPasteboard+Utils.h ('k') | third_party/mozilla/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698