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 blink; | |
47 | |
48 namespace blink { | 46 namespace blink { |
49 | 47 |
50 void WebDragData::initialize() | 48 void WebDragData::initialize() |
51 { | 49 { |
52 m_private = DataObject::create(); | 50 m_private = DataObject::create(); |
53 } | 51 } |
54 | 52 |
55 void WebDragData::reset() | 53 void WebDragData::reset() |
56 { | 54 { |
57 m_private.reset(); | 55 m_private.reset(); |
58 } | 56 } |
59 | 57 |
60 void WebDragData::assign(const WebDragData& other) | 58 void WebDragData::assign(const WebDragData& other) |
61 { | 59 { |
62 m_private = other.m_private; | 60 m_private = other.m_private; |
63 } | 61 } |
64 | 62 |
65 WebDragData::WebDragData(const PassRefPtrWillBeRawPtr<blink::DataObject>& object
) | 63 WebDragData::WebDragData(const PassRefPtrWillBeRawPtr<DataObject>& object) |
66 { | 64 { |
67 m_private = object; | 65 m_private = object; |
68 } | 66 } |
69 | 67 |
70 WebDragData& WebDragData::operator=(const PassRefPtrWillBeRawPtr<blink::DataObje
ct>& object) | 68 WebDragData& WebDragData::operator=(const PassRefPtrWillBeRawPtr<DataObject>& ob
ject) |
71 { | 69 { |
72 m_private = object; | 70 m_private = object; |
73 return *this; | 71 return *this; |
74 } | 72 } |
75 | 73 |
76 DataObject* WebDragData::getValue() const | 74 DataObject* WebDragData::getValue() const |
77 { | 75 { |
78 return m_private.get(); | 76 return m_private.get(); |
79 } | 77 } |
80 | 78 |
(...skipping 10 matching lines...) Expand all Loading... |
91 WebDragData::Item item; | 89 WebDragData::Item item; |
92 if (originalItem->kind() == DataObjectItem::StringKind) { | 90 if (originalItem->kind() == DataObjectItem::StringKind) { |
93 item.storageType = Item::StorageTypeString; | 91 item.storageType = Item::StorageTypeString; |
94 item.stringType = originalItem->type(); | 92 item.stringType = originalItem->type(); |
95 item.stringData = originalItem->getAsString(); | 93 item.stringData = originalItem->getAsString(); |
96 } else if (originalItem->kind() == DataObjectItem::FileKind) { | 94 } else if (originalItem->kind() == DataObjectItem::FileKind) { |
97 if (originalItem->sharedBuffer()) { | 95 if (originalItem->sharedBuffer()) { |
98 item.storageType = Item::StorageTypeBinaryData; | 96 item.storageType = Item::StorageTypeBinaryData; |
99 item.binaryData = originalItem->sharedBuffer(); | 97 item.binaryData = originalItem->sharedBuffer(); |
100 } else if (originalItem->isFilename()) { | 98 } else if (originalItem->isFilename()) { |
101 RefPtrWillBeRawPtr<blink::Blob> blob = originalItem->getAsFile()
; | 99 RefPtrWillBeRawPtr<Blob> blob = originalItem->getAsFile(); |
102 if (blob->isFile()) { | 100 if (blob->isFile()) { |
103 File* file = toFile(blob.get()); | 101 File* file = toFile(blob.get()); |
104 if (file->hasBackingFile()) { | 102 if (file->hasBackingFile()) { |
105 if (file->userVisibility() == File::IsUserVisible) { | 103 if (file->userVisibility() == File::IsUserVisible) { |
106 item.storageType = Item::StorageTypeFilename; | 104 item.storageType = Item::StorageTypeFilename; |
107 item.filenameData = file->path(); | 105 item.filenameData = file->path(); |
108 item.displayNameData = file->name(); | 106 item.displayNameData = file->name(); |
109 } else { | 107 } else { |
110 item.storageType = Item::StorageTypeFileSystemFile; | 108 item.storageType = Item::StorageTypeFileSystemFile; |
111 item.fileSystemURL = file->fileSystemURL(); | 109 item.fileSystemURL = file->fileSystemURL(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 174 } |
177 | 175 |
178 void WebDragData::setFilesystemId(const WebString& filesystemId) | 176 void WebDragData::setFilesystemId(const WebString& filesystemId) |
179 { | 177 { |
180 // The ID is an opaque string, given by and validated by chromium port. | 178 // The ID is an opaque string, given by and validated by chromium port. |
181 ensureMutable(); | 179 ensureMutable(); |
182 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); | 180 DraggedIsolatedFileSystem::provideTo(*m_private.get(), DraggedIsolatedFileSy
stem::supplementName(), DraggedIsolatedFileSystem::create(*m_private.get(), file
systemId)); |
183 } | 181 } |
184 | 182 |
185 } // namespace blink | 183 } // namespace blink |
OLD | NEW |