From ef8413855c5e505d12843fc31eb69e4b5bead560 Mon Sep 17 00:00:00 2001 From: "jianli@chromium.org" Date: Fri, 9 Oct 2009 21:26:29 +0000 Subject: 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 --- chrome/browser/cocoa/web_drop_target.mm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'chrome') 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 -- cgit v1.1