| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/clipboard/ClipboardMimeTypes.h" | 36 #include "platform/clipboard/ClipboardMimeTypes.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "public/platform/WebData.h" | 38 #include "public/platform/WebData.h" |
| 39 #include "public/platform/WebDragData.h" | 39 #include "public/platform/WebDragData.h" |
| 40 #include "public/platform/WebString.h" | 40 #include "public/platform/WebString.h" |
| 41 #include "public/platform/WebURL.h" | 41 #include "public/platform/WebURL.h" |
| 42 #include "public/platform/WebVector.h" | 42 #include "public/platform/WebVector.h" |
| 43 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 44 #include "wtf/PassRefPtr.h" | 44 #include "wtf/PassRefPtr.h" |
| 45 | 45 |
| 46 using namespace WebCore; | 46 using namespace blink; |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 void WebDragData::initialize() | 50 void WebDragData::initialize() |
| 51 { | 51 { |
| 52 m_private = DataObject::create(); | 52 m_private = DataObject::create(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void WebDragData::reset() | 55 void WebDragData::reset() |
| 56 { | 56 { |
| 57 m_private.reset(); | 57 m_private.reset(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WebDragData::assign(const WebDragData& other) | 60 void WebDragData::assign(const WebDragData& other) |
| 61 { | 61 { |
| 62 m_private = other.m_private; | 62 m_private = other.m_private; |
| 63 } | 63 } |
| 64 | 64 |
| 65 WebDragData::WebDragData(const PassRefPtrWillBeRawPtr<WebCore::DataObject>& obje
ct) | 65 WebDragData::WebDragData(const PassRefPtrWillBeRawPtr<blink::DataObject>& object
) |
| 66 { | 66 { |
| 67 m_private = object; | 67 m_private = object; |
| 68 } | 68 } |
| 69 | 69 |
| 70 WebDragData& WebDragData::operator=(const PassRefPtrWillBeRawPtr<WebCore::DataOb
ject>& object) | 70 WebDragData& WebDragData::operator=(const PassRefPtrWillBeRawPtr<blink::DataObje
ct>& object) |
| 71 { | 71 { |
| 72 m_private = object; | 72 m_private = object; |
| 73 return *this; | 73 return *this; |
| 74 } | 74 } |
| 75 | 75 |
| 76 DataObject* WebDragData::getValue() const | 76 DataObject* WebDragData::getValue() const |
| 77 { | 77 { |
| 78 return m_private.get(); | 78 return m_private.get(); |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 WebDragData::Item item; | 91 WebDragData::Item item; |
| 92 if (originalItem->kind() == DataObjectItem::StringKind) { | 92 if (originalItem->kind() == DataObjectItem::StringKind) { |
| 93 item.storageType = Item::StorageTypeString; | 93 item.storageType = Item::StorageTypeString; |
| 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<WebCore::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->path().isEmpty()) { |
| 105 item.storageType = Item::StorageTypeFilename; | 105 item.storageType = Item::StorageTypeFilename; |
| 106 item.filenameData = file->path(); | 106 item.filenameData = file->path(); |
| 107 item.displayNameData = file->name(); | 107 item.displayNameData = file->name(); |
| 108 } else if (!file->fileSystemURL().isEmpty()) { | 108 } else if (!file->fileSystemURL().isEmpty()) { |
| 109 item.storageType = Item::StorageTypeFileSystemFile; | 109 item.storageType = Item::StorageTypeFileSystemFile; |
| 110 item.fileSystemURL = file->fileSystemURL(); | 110 item.fileSystemURL = file->fileSystemURL(); |
| 111 item.fileSystemFileSize = file->size(); | 111 item.fileSystemFileSize = file->size(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 void WebDragData::setFilesystemId(const WebString& filesystemId) | 170 void WebDragData::setFilesystemId(const WebString& filesystemId) |
| 171 { | 171 { |
| 172 // The ID is an opaque string, given by and validated by chromium port. | 172 // The ID is an opaque string, given by and validated by chromium port. |
| 173 ensureMutable(); | 173 ensureMutable(); |
| 174 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); | 174 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace blink | 177 } // namespace blink |
| OLD | NEW |