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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/platform/chromium/ChromiumDataObject.h" | 32 #include "core/platform/chromium/ChromiumDataObject.h" |
33 | 33 |
34 #include "bindings/v8/ExceptionMessages.h" | |
35 #include "bindings/v8/ExceptionState.h" | 34 #include "bindings/v8/ExceptionState.h" |
36 #include "bindings/v8/ExceptionStatePlaceholder.h" | 35 #include "bindings/v8/ExceptionStatePlaceholder.h" |
37 #include "core/dom/DataTransferItem.h" | 36 #include "core/dom/DataTransferItem.h" |
38 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
39 #include "core/platform/Pasteboard.h" | 38 #include "core/platform/Pasteboard.h" |
40 #include "platform/clipboard/ClipboardMimeTypes.h" | 39 #include "platform/clipboard/ClipboardMimeTypes.h" |
41 #include "platform/clipboard/ClipboardUtilities.h" | 40 #include "platform/clipboard/ClipboardUtilities.h" |
42 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
43 #include "public/platform/WebClipboard.h" | 42 #include "public/platform/WebClipboard.h" |
44 | 43 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 92 |
94 void ChromiumDataObject::clearAll() | 93 void ChromiumDataObject::clearAll() |
95 { | 94 { |
96 m_itemList.clear(); | 95 m_itemList.clear(); |
97 } | 96 } |
98 | 97 |
99 PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(const String& data, c
onst String& type, ExceptionState& exceptionState) | 98 PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(const String& data, c
onst String& type, ExceptionState& exceptionState) |
100 { | 99 { |
101 RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromStri
ng(type, data); | 100 RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromStri
ng(type, data); |
102 if (!internalAddStringItem(item)) { | 101 if (!internalAddStringItem(item)) { |
103 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::f
ailedToExecute("add", "DataTransferItemList")); | 102 exceptionState.throwDOMException(NotSupportedError, "An item already exi
sts for type '" + type + "'."); |
104 return 0; | 103 return 0; |
105 } | 104 } |
106 return item; | 105 return item; |
107 } | 106 } |
108 | 107 |
109 PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file
) | 108 PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file
) |
110 { | 109 { |
111 if (!file) | 110 if (!file) |
112 return 0; | 111 return 0; |
113 | 112 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return true; | 260 return true; |
262 } | 261 } |
263 | 262 |
264 void ChromiumDataObject::internalAddFileItem(PassRefPtr<ChromiumDataObjectItem>
item) | 263 void ChromiumDataObject::internalAddFileItem(PassRefPtr<ChromiumDataObjectItem>
item) |
265 { | 264 { |
266 ASSERT(item->kind() == DataTransferItem::kindFile); | 265 ASSERT(item->kind() == DataTransferItem::kindFile); |
267 m_itemList.append(item); | 266 m_itemList.append(item); |
268 } | 267 } |
269 | 268 |
270 } // namespace WebCore | 269 } // namespace WebCore |
OLD | NEW |