OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Google Inc. | 3 * Copyright (C) 2008, 2009 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (!m_clipboard->canWriteData()) | 85 if (!m_clipboard->canWriteData()) |
86 return nullptr; | 86 return nullptr; |
87 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(data, type); | 87 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(data, type); |
88 if (!item) { | 88 if (!item) { |
89 exceptionState.throwDOMException(NotSupportedError, "An item already exi
sts for type '" + type + "'."); | 89 exceptionState.throwDOMException(NotSupportedError, "An item already exi
sts for type '" + type + "'."); |
90 return nullptr; | 90 return nullptr; |
91 } | 91 } |
92 return DataTransferItem::create(m_clipboard, item); | 92 return DataTransferItem::create(m_clipboard, item); |
93 } | 93 } |
94 | 94 |
95 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItemList::add(PassRefPtr<Fi
le> file) | 95 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItemList::add(PassRefPtrWil
lBeRawPtr<File> file) |
96 { | 96 { |
97 if (!m_clipboard->canWriteData()) | 97 if (!m_clipboard->canWriteData()) |
98 return nullptr; | 98 return nullptr; |
99 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(file); | 99 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(file); |
100 if (!item) | 100 if (!item) |
101 return nullptr; | 101 return nullptr; |
102 return DataTransferItem::create(m_clipboard, item); | 102 return DataTransferItem::create(m_clipboard, item); |
103 } | 103 } |
104 | 104 |
105 DataTransferItemList::DataTransferItemList(PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, PassRefPtrWillBeRawPtr<DataObject> dataObject) | 105 DataTransferItemList::DataTransferItemList(PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, PassRefPtrWillBeRawPtr<DataObject> dataObject) |
106 : m_clipboard(clipboard) | 106 : m_clipboard(clipboard) |
107 , m_dataObject(dataObject) | 107 , m_dataObject(dataObject) |
108 { | 108 { |
109 ScriptWrappable::init(this); | 109 ScriptWrappable::init(this); |
110 } | 110 } |
111 | 111 |
112 void DataTransferItemList::trace(Visitor* visitor) | 112 void DataTransferItemList::trace(Visitor* visitor) |
113 { | 113 { |
114 visitor->trace(m_clipboard); | 114 visitor->trace(m_clipboard); |
115 visitor->trace(m_dataObject); | 115 visitor->trace(m_dataObject); |
116 } | 116 } |
117 | 117 |
118 } // namespace WebCore | 118 } // namespace WebCore |
OLD | NEW |