OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "content/browser/web_contents/web_drag_dest_mac.h" | 5 #import "content/browser/web_contents/web_drag_dest_mac.h" |
6 | 6 |
7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 // Get files. | 285 // Get files. |
286 if ([types containsObject:NSFilenamesPboardType]) { | 286 if ([types containsObject:NSFilenamesPboardType]) { |
287 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; | 287 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; |
288 if ([files isKindOfClass:[NSArray class]] && [files count]) { | 288 if ([files isKindOfClass:[NSArray class]] && [files count]) { |
289 for (NSUInteger i = 0; i < [files count]; i++) { | 289 for (NSUInteger i = 0; i < [files count]; i++) { |
290 NSString* filename = [files objectAtIndex:i]; | 290 NSString* filename = [files objectAtIndex:i]; |
291 BOOL exists = [[NSFileManager defaultManager] | 291 BOOL exists = [[NSFileManager defaultManager] |
292 fileExistsAtPath:filename]; | 292 fileExistsAtPath:filename]; |
293 if (exists) { | 293 if (exists) { |
294 data->filenames.push_back( | 294 data->filenames.push_back(ui::FileInfo( |
295 DropData::FileInfo( | 295 base::FilePath::FromUTF8Unsafe(base::SysNSStringToUTF8(filename)), |
296 base::SysNSStringToUTF16(filename), base::string16())); | 296 base::FilePath())); |
297 } | 297 } |
298 } | 298 } |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 // TODO(pinkerton): Get file contents. http://crbug.com/34661 | 302 // TODO(pinkerton): Get file contents. http://crbug.com/34661 |
303 | 303 |
304 // Get custom MIME data. | 304 // Get custom MIME data. |
305 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 305 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
306 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 306 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
307 ui::ReadCustomDataIntoMap([customData bytes], | 307 ui::ReadCustomDataIntoMap([customData bytes], |
308 [customData length], | 308 [customData length], |
309 &data->custom_data); | 309 &data->custom_data); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 @end | 313 @end |
OLD | NEW |