OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // improvements to this code (in particular, add a registerClipboardBlob | 142 // improvements to this code (in particular, add a registerClipboardBlob |
143 // method to the blob registry; that way the data is only copied over | 143 // method to the blob registry; that way the data is only copied over |
144 // into the renderer when it's actually read, not when the blob is | 144 // into the renderer when it's actually read, not when the blob is |
145 // initially constructed). | 145 // initially constructed). |
146 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(WebKi
t::Platform::current()->clipboard()->readImage(WebKit::WebClipboard::BufferStand
ard)); | 146 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(WebKi
t::Platform::current()->clipboard()->readImage(WebKit::WebClipboard::BufferStand
ard)); |
147 RefPtr<RawData> rawData = RawData::create(); | 147 RefPtr<RawData> rawData = RawData::create(); |
148 rawData->mutableData()->append(data->data(), data->size()); | 148 rawData->mutableData()->append(data->data(), data->size()); |
149 OwnPtr<BlobData> blobData = BlobData::create(); | 149 OwnPtr<BlobData> blobData = BlobData::create(); |
150 blobData->appendData(rawData, 0, -1); | 150 blobData->appendData(rawData, 0, -1); |
151 blobData->setContentType(mimeTypeImagePng); | 151 blobData->setContentType(mimeTypeImagePng); |
152 return Blob::create(blobData.release(), data->size()); | 152 return Blob::create(BlobDataHandle::create(blobData.release(), data->siz
e())); |
153 } | 153 } |
154 | 154 |
155 return 0; | 155 return 0; |
156 } | 156 } |
157 | 157 |
158 String ChromiumDataObjectItem::internalGetAsString() const | 158 String ChromiumDataObjectItem::internalGetAsString() const |
159 { | 159 { |
160 ASSERT(m_kind == DataTransferItem::kindString); | 160 ASSERT(m_kind == DataTransferItem::kindString); |
161 | 161 |
162 if (m_source == InternalSource) | 162 if (m_source == InternalSource) |
(...skipping 18 matching lines...) Expand all Loading... |
181 bool ChromiumDataObjectItem::isFilename() const | 181 bool ChromiumDataObjectItem::isFilename() const |
182 { | 182 { |
183 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su
pport File dragout, | 183 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su
pport File dragout, |
184 // we'll need to make sure this works as expected for DragDataChromium. | 184 // we'll need to make sure this works as expected for DragDataChromium. |
185 return m_kind == DataTransferItem::kindFile && m_file; | 185 return m_kind == DataTransferItem::kindFile && m_file; |
186 } | 186 } |
187 | 187 |
188 } // namespace WebCore | 188 } // namespace WebCore |
189 | 189 |
190 #endif // ENABLE(DATA_TRANSFER_ITEMS) | 190 #endif // ENABLE(DATA_TRANSFER_ITEMS) |
OLD | NEW |