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

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: mac: stop parsing text as url. 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..0cd0eee5f1f3ed8d7bee4c9240ed9052271cfc61 100644
--- a/third_party/mozilla/NSPasteboard+Utils.mm
+++ b/third_party/mozilla/NSPasteboard+Utils.mm
@@ -231,21 +231,6 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
if (!title && [types containsObject:NSStringPboardType])
title = [self stringForType:NSStringPboardType];
*outTitles = [NSArray arrayWithObject:(title ? title : @"")];
- } else if ([types containsObject:NSStringPboardType]) {
- NSString* potentialURLString = [self cleanedStringWithPasteboardString:[self stringForType:NSStringPboardType]];
- if ([potentialURLString isValidURI]) {
- *outUrls = [NSArray arrayWithObject:potentialURLString];
- NSString* title = nil;
- if ([types containsObject:kCorePasteboardFlavorType_urld])
- title = [self stringForType:kCorePasteboardFlavorType_urld];
- if (!title && [types containsObject:kCorePasteboardFlavorType_urln])
- title = [self stringForType:kCorePasteboardFlavorType_urln];
- *outTitles = [NSArray arrayWithObject:(title ? title : @"")];
- } else {
- // The string doesn't look like a URL - return empty arrays
- *outUrls = [NSArray array];
- *outTitles = [NSArray array];
- }
} else {
// We don't recognise any of these formats - return empty arrays
*outUrls = [NSArray array];
@@ -264,19 +249,9 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
- (BOOL) containsURLData
{
NSArray* types = [self types];
- if ( [types containsObject:kWebURLsWithTitlesPboardType]
- || [types containsObject:NSURLPboardType]
- || [types containsObject:NSFilenamesPboardType] )
- return YES;
-
- if ([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]];
- return [potentialURLString isValidURI];
- }
-
- return NO;
+ return [types containsObject:kWebURLsWithTitlesPboardType] ||
+ [types containsObject:NSURLPboardType] ||
+ [types containsObject:NSFilenamesPboardType];
}
@end

Powered by Google App Engine
This is Rietveld 408576698