| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 item.stringType = originalItem->type(); | 94 item.stringType = originalItem->type(); |
| 95 item.stringData = originalItem->getAsString(); | 95 item.stringData = originalItem->getAsString(); |
| 96 } else if (originalItem->kind() == DataObjectItem::FileKind) { | 96 } else if (originalItem->kind() == DataObjectItem::FileKind) { |
| 97 if (originalItem->sharedBuffer()) { | 97 if (originalItem->sharedBuffer()) { |
| 98 item.storageType = Item::StorageTypeBinaryData; | 98 item.storageType = Item::StorageTypeBinaryData; |
| 99 item.binaryData = originalItem->sharedBuffer(); | 99 item.binaryData = originalItem->sharedBuffer(); |
| 100 } else if (originalItem->isFilename()) { | 100 } else if (originalItem->isFilename()) { |
| 101 RefPtrWillBeRawPtr<blink::Blob> blob = originalItem->getAsFile()
; | 101 RefPtrWillBeRawPtr<blink::Blob> blob = originalItem->getAsFile()
; |
| 102 if (blob->isFile()) { | 102 if (blob->isFile()) { |
| 103 File* file = toFile(blob.get()); | 103 File* file = toFile(blob.get()); |
| 104 if (!file->path().isEmpty()) { | 104 if (file->hasBackingFile()) { |
| 105 item.storageType = Item::StorageTypeFilename; | 105 if (file->userVisibility() == File::IsUserVisible) { |
| 106 item.filenameData = file->path(); | 106 item.storageType = Item::StorageTypeFilename; |
| 107 item.displayNameData = file->name(); | 107 item.filenameData = file->path(); |
| 108 } else if (!file->fileSystemURL().isEmpty()) { | 108 item.displayNameData = file->name(); |
| 109 item.storageType = Item::StorageTypeFileSystemFile; | 109 } else { |
| 110 item.fileSystemURL = file->fileSystemURL(); | 110 item.storageType = Item::StorageTypeFileSystemFile; |
| 111 item.fileSystemFileSize = file->size(); | 111 item.fileSystemURL = file->fileSystemURL(); |
| 112 item.fileSystemFileSize = file->size(); |
| 113 } |
| 112 } else { | 114 } else { |
| 113 ASSERT_NOT_REACHED(); | 115 // FIXME: support dragging constructed Files across rend
erers, see http://crbug.com/394955 |
| 116 item.storageType = Item::StorageTypeString; |
| 117 item.stringType = "text/plain"; |
| 118 item.stringData = file->name(); |
| 114 } | 119 } |
| 115 } else | 120 } else { |
| 116 ASSERT_NOT_REACHED(); | 121 ASSERT_NOT_REACHED(); |
| 117 } else | 122 } |
| 123 } else { |
| 118 ASSERT_NOT_REACHED(); | 124 ASSERT_NOT_REACHED(); |
| 119 } else | 125 } |
| 126 } else { |
| 120 ASSERT_NOT_REACHED(); | 127 ASSERT_NOT_REACHED(); |
| 128 } |
| 121 item.title = originalItem->title(); | 129 item.title = originalItem->title(); |
| 122 item.baseURL = originalItem->baseURL(); | 130 item.baseURL = originalItem->baseURL(); |
| 123 itemList.append(item); | 131 itemList.append(item); |
| 124 } | 132 } |
| 125 return itemList; | 133 return itemList; |
| 126 } | 134 } |
| 127 | 135 |
| 128 void WebDragData::setItems(const WebVector<Item>& itemList) | 136 void WebDragData::setItems(const WebVector<Item>& itemList) |
| 129 { | 137 { |
| 130 m_private->clearAll(); | 138 m_private->clearAll(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 176 } |
| 169 | 177 |
| 170 void WebDragData::setFilesystemId(const WebString& filesystemId) | 178 void WebDragData::setFilesystemId(const WebString& filesystemId) |
| 171 { | 179 { |
| 172 // The ID is an opaque string, given by and validated by chromium port. | 180 // The ID is an opaque string, given by and validated by chromium port. |
| 173 ensureMutable(); | 181 ensureMutable(); |
| 174 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); | 182 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); |
| 175 } | 183 } |
| 176 | 184 |
| 177 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |