diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 21:26:29 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 21:26:29 +0000 |
commit | ef8413855c5e505d12843fc31eb69e4b5bead560 (patch) | |
tree | ce9ff0e166129be60df38ea7f343bb86d2dbf1d3 /chrome/browser/cocoa/web_drop_target.mm | |
parent | 258fea3d05ccbb0c44b48ef6b2d06efdad5fbaca (diff) | |
download | chromium_src-ef8413855c5e505d12843fc31eb69e4b5bead560.zip chromium_src-ef8413855c5e505d12843fc31eb69e4b5bead560.tar.gz chromium_src-ef8413855c5e505d12843fc31eb69e4b5bead560.tar.bz2 |
Fix the problem that files cannot be dropped on the input widget on the Mac.
BUG=19529
TEST=none
Review URL: http://codereview.chromium.org/270026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/web_drop_target.mm')
-rw-r--r-- | chrome/browser/cocoa/web_drop_target.mm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/web_drop_target.mm b/chrome/browser/cocoa/web_drop_target.mm index a7eaac6..8fa49b7 100644 --- a/chrome/browser/cocoa/web_drop_target.mm +++ b/chrome/browser/cocoa/web_drop_target.mm @@ -215,7 +215,22 @@ using WebKit::WebDragOperationsMask; base::SysNSStringToUTF16([pboard stringForType:NSHTMLPboardType]); } - // TODO(pinkerton): Get files and file contents. + // Get files. + if ([types containsObject:NSFilenamesPboardType]) { + NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; + if ([files isKindOfClass:[NSArray class]] && [files count]) { + for (NSUInteger i = 0; i < [files count]; i++) { + NSString* filename = [files objectAtIndex:i]; + BOOL isDir = NO; + BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:filename + isDirectory:&isDir]; + if (exists && !isDir) + data->filenames.push_back(base::SysNSStringToUTF16(filename)); + } + } + } + + // TODO(pinkerton): Get file contents. } @end |