summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 04:45:27 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 04:45:27 +0000
commitc95efd392aa8835e80b34e1b29dd3a224c4e575b (patch)
treef8b9ca10e16918f045d003e170dd30bd97e78284 /third_party
parent703f8d749f9cb925a83a531eda5f2a1fd897b230 (diff)
downloadchromium_src-c95efd392aa8835e80b34e1b29dd3a224c4e575b.zip
chromium_src-c95efd392aa8835e80b34e1b29dd3a224c4e575b.tar.gz
chromium_src-c95efd392aa8835e80b34e1b29dd3a224c4e575b.tar.bz2
Don't populate WebDropData with file URLs when dragging files.
This is the OS X patch. There will be separate patches for Windows and Linux. BUG=42685 TEST=unit_tests --gtest_filter=WebDropTargetTest.* Review URL: http://codereview.chromium.org/2095011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/mozilla/NSPasteboard+Utils.h4
-rw-r--r--third_party/mozilla/NSPasteboard+Utils.mm21
-rw-r--r--third_party/mozilla/README.chromium7
3 files changed, 21 insertions, 11 deletions
diff --git a/third_party/mozilla/NSPasteboard+Utils.h b/third_party/mozilla/NSPasteboard+Utils.h
index 5c2f1e1..c75de6a 100644
--- a/third_party/mozilla/NSPasteboard+Utils.h
+++ b/third_party/mozilla/NSPasteboard+Utils.h
@@ -51,7 +51,9 @@ extern NSString* const kWebURLsWithTitlesPboardType;
- (void) setDataForURL:(NSString*)url title:(NSString*)title;
- (void) setURLs:(NSArray*)inUrls withTitles:(NSArray*)inTitles;
-- (void) getURLs:(NSArray**)outUrls andTitles:(NSArray**)outTitles;
+- (void) getURLs:(NSArray**)outUrls
+ andTitles:(NSArray**)outTitles
+ convertingFilenames:(BOOL)convertFilenames;
- (BOOL) containsURLData;
@end
diff --git a/third_party/mozilla/NSPasteboard+Utils.mm b/third_party/mozilla/NSPasteboard+Utils.mm
index bfd87de..8ac1ba5 100644
--- a/third_party/mozilla/NSPasteboard+Utils.mm
+++ b/third_party/mozilla/NSPasteboard+Utils.mm
@@ -166,13 +166,15 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
}
}
-//
-// Get the set of URLs and their corresponding titles from the clipboards
+// Get the set of URLs and their corresponding titles from the pasteboard.
// If there are no URLs in a format we understand on the pasteboard empty
// arrays will be returned. The two arrays will always be the same size.
-// The arrays returned are on the auto release pool.
-//
-- (void) getURLs:(NSArray**)outUrls andTitles:(NSArray**)outTitles
+// The arrays returned are on the auto release pool. If |convertFilenames|
+// is YES, then the function will attempt to convert filenames in the drag
+// to file URLs.
+- (void) getURLs:(NSArray**)outUrls
+ andTitles:(NSArray**)outTitles
+ convertingFilenames:(BOOL)convertFilenames
{
NSArray* types = [self types];
NSURL* urlFromNSURL = nil; // Used below in getting an URL from the NSURLPboardType.
@@ -206,10 +208,13 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
}
}
- // Use the filename if not a .webloc or .url file, or if either of the
- // functions returns nil.
if (!urlString) {
- urlString = file;
+ if (!convertFilenames) {
+ continue;
+ }
+ // Use the filename if not a .webloc or .url file, or if either of the
+ // functions returns nil.
+ urlString = [[NSURL fileURLWithPath:file] absoluteString];
title = [file lastPathComponent];
}
diff --git a/third_party/mozilla/README.chromium b/third_party/mozilla/README.chromium
index 658fd72..fc5779c 100644
--- a/third_party/mozilla/README.chromium
+++ b/third_party/mozilla/README.chromium
@@ -12,7 +12,10 @@ Description:
NSWorkspace+Utils.h/m
Local modifications:
- NSURL+Utils.m was modified to use non-deprecated Cocoa APIs to allow
+- NSURL+Utils.m was modified to use non-deprecated Cocoa APIs to allow
compilation on future versions of Mac OS X.
- NSString+Utils.m was renamed to NSString+Utils.mm and modified to use GURL
+- NSString+Utils.m was renamed to NSString+Utils.mm and modified to use GURL
for validation in -[NSString isValidURI].
+- NSPasteboard+Utils.mm was modified to add an argument to
+ -[NSPasteboard getURLs:andTitles:] to determine whether or not filenames in
+ the drag should be converted to file URLs.