diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 04:45:27 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 04:45:27 +0000 |
commit | c95efd392aa8835e80b34e1b29dd3a224c4e575b (patch) | |
tree | f8b9ca10e16918f045d003e170dd30bd97e78284 /third_party/mozilla/NSPasteboard+Utils.mm | |
parent | 703f8d749f9cb925a83a531eda5f2a1fd897b230 (diff) | |
download | chromium_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/mozilla/NSPasteboard+Utils.mm')
-rw-r--r-- | third_party/mozilla/NSPasteboard+Utils.mm | 21 |
1 files changed, 13 insertions, 8 deletions
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]; } |