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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (!m_clipboard->canWriteData()) | 83 if (!m_clipboard->canWriteData()) |
84 return nullptr; | 84 return nullptr; |
85 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(data, type); | 85 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(data, type); |
86 if (!item) { | 86 if (!item) { |
87 exceptionState.throwDOMException(NotSupportedError, "An item already exi
sts for type '" + type + "'."); | 87 exceptionState.throwDOMException(NotSupportedError, "An item already exi
sts for type '" + type + "'."); |
88 return nullptr; | 88 return nullptr; |
89 } | 89 } |
90 return DataTransferItem::create(m_clipboard, item); | 90 return DataTransferItem::create(m_clipboard, item); |
91 } | 91 } |
92 | 92 |
93 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItemList::add(PassRefPtr<Fi
le> file) | 93 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItemList::add(PassRefPtrWil
lBeRawPtr<File> file) |
94 { | 94 { |
95 if (!m_clipboard->canWriteData()) | 95 if (!m_clipboard->canWriteData()) |
96 return nullptr; | 96 return nullptr; |
97 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(file); | 97 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->add(file); |
98 if (!item) | 98 if (!item) |
99 return nullptr; | 99 return nullptr; |
100 return DataTransferItem::create(m_clipboard, item); | 100 return DataTransferItem::create(m_clipboard, item); |
101 } | 101 } |
102 | 102 |
103 DataTransferItemList::DataTransferItemList(PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, PassRefPtrWillBeRawPtr<DataObject> dataObject) | 103 DataTransferItemList::DataTransferItemList(PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, PassRefPtrWillBeRawPtr<DataObject> dataObject) |
104 : m_clipboard(clipboard) | 104 : m_clipboard(clipboard) |
105 , m_dataObject(dataObject) | 105 , m_dataObject(dataObject) |
106 { | 106 { |
107 ScriptWrappable::init(this); | 107 ScriptWrappable::init(this); |
108 } | 108 } |
109 | 109 |
110 void DataTransferItemList::trace(Visitor* visitor) | 110 void DataTransferItemList::trace(Visitor* visitor) |
111 { | 111 { |
112 visitor->trace(m_clipboard); | 112 visitor->trace(m_clipboard); |
113 visitor->trace(m_dataObject); | 113 visitor->trace(m_dataObject); |
114 } | 114 } |
115 | 115 |
116 } // namespace WebCore | 116 } // namespace WebCore |
OLD | NEW |