| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 else | 260 else |
| 261 dataObject->setData(item.stringType, item.stringData); | 261 dataObject->setData(item.stringType, item.stringData); |
| 262 break; | 262 break; |
| 263 case WebDragData::Item::StorageTypeFilename: | 263 case WebDragData::Item::StorageTypeFilename: |
| 264 dataObject->addFilename(item.filenameData, item.displayNameData); | 264 dataObject->addFilename(item.filenameData, item.displayNameData); |
| 265 break; | 265 break; |
| 266 case WebDragData::Item::StorageTypeBinaryData: | 266 case WebDragData::Item::StorageTypeBinaryData: |
| 267 // This should never happen when dragging in. | 267 // This should never happen when dragging in. |
| 268 break; | 268 break; |
| 269 case WebDragData::Item::StorageTypeFileSystemFile: { | 269 case WebDragData::Item::StorageTypeFileSystemFile: { |
| 270 // FIXME: The file system URL may refer a user visible file, see http://
crbug.com/429077 | 270 // FIXME: The file system URL may refer a user visible file, see |
| 271 // http://crbug.com/429077 |
| 271 FileMetadata fileMetadata; | 272 FileMetadata fileMetadata; |
| 272 fileMetadata.length = item.fileSystemFileSize; | 273 fileMetadata.length = item.fileSystemFileSize; |
| 273 dataObject->add(File::createForFileSystemFile( | 274 dataObject->add(File::createForFileSystemFile( |
| 274 item.fileSystemURL, fileMetadata, File::IsNotUserVisible)); | 275 item.fileSystemURL, fileMetadata, File::IsNotUserVisible)); |
| 275 } break; | 276 } break; |
| 276 } | 277 } |
| 277 } | 278 } |
| 278 | 279 |
| 279 if (!data.filesystemId().isNull()) | 280 if (!data.filesystemId().isNull()) |
| 280 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, | 281 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 305 File* file = toFile(blob); | 306 File* file = toFile(blob); |
| 306 if (file->hasBackingFile()) { | 307 if (file->hasBackingFile()) { |
| 307 item.storageType = WebDragData::Item::StorageTypeFilename; | 308 item.storageType = WebDragData::Item::StorageTypeFilename; |
| 308 item.filenameData = file->path(); | 309 item.filenameData = file->path(); |
| 309 item.displayNameData = file->name(); | 310 item.displayNameData = file->name(); |
| 310 } else if (!file->fileSystemURL().isEmpty()) { | 311 } else if (!file->fileSystemURL().isEmpty()) { |
| 311 item.storageType = WebDragData::Item::StorageTypeFileSystemFile; | 312 item.storageType = WebDragData::Item::StorageTypeFileSystemFile; |
| 312 item.fileSystemURL = file->fileSystemURL(); | 313 item.fileSystemURL = file->fileSystemURL(); |
| 313 item.fileSystemFileSize = file->size(); | 314 item.fileSystemFileSize = file->size(); |
| 314 } else { | 315 } else { |
| 315 // FIXME: support dragging constructed Files across renderers, see h
ttp://crbug.com/394955 | 316 // FIXME: support dragging constructed Files across renderers, see |
| 317 // http://crbug.com/394955 |
| 316 item.storageType = WebDragData::Item::StorageTypeString; | 318 item.storageType = WebDragData::Item::StorageTypeString; |
| 317 item.stringType = "text/plain"; | 319 item.stringType = "text/plain"; |
| 318 item.stringData = file->name(); | 320 item.stringData = file->name(); |
| 319 } | 321 } |
| 320 } else { | 322 } else { |
| 321 ASSERT_NOT_REACHED(); | 323 ASSERT_NOT_REACHED(); |
| 322 } | 324 } |
| 323 } else { | 325 } else { |
| 324 ASSERT_NOT_REACHED(); | 326 ASSERT_NOT_REACHED(); |
| 325 } | 327 } |
| 326 } else { | 328 } else { |
| 327 ASSERT_NOT_REACHED(); | 329 ASSERT_NOT_REACHED(); |
| 328 } | 330 } |
| 329 item.title = originalItem->title(); | 331 item.title = originalItem->title(); |
| 330 item.baseURL = originalItem->baseURL(); | 332 item.baseURL = originalItem->baseURL(); |
| 331 itemList[i] = item; | 333 itemList[i] = item; |
| 332 } | 334 } |
| 333 data.swapItems(itemList); | 335 data.swapItems(itemList); |
| 334 return data; | 336 return data; |
| 335 } | 337 } |
| 336 | 338 |
| 337 } // namespace blink | 339 } // namespace blink |
| OLD | NEW |