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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (type() == mimeTypeImagePng) { | 119 if (type() == mimeTypeImagePng) { |
120 // FIXME: This is pretty inefficient. We copy the data from the browser | 120 // FIXME: This is pretty inefficient. We copy the data from the browser |
121 // to the renderer. We then place it in a blob in WebKit, which | 121 // to the renderer. We then place it in a blob in WebKit, which |
122 // registers it and copies it *back* to the browser. When a consumer | 122 // registers it and copies it *back* to the browser. When a consumer |
123 // wants to read the data, we then copy the data back into the renderer. | 123 // wants to read the data, we then copy the data back into the renderer. |
124 // https://bugs.webkit.org/show_bug.cgi?id=58107 has been filed to track | 124 // https://bugs.webkit.org/show_bug.cgi?id=58107 has been filed to track |
125 // improvements to this code (in particular, add a registerClipboardBlob | 125 // improvements to this code (in particular, add a registerClipboardBlob |
126 // method to the blob registry; that way the data is only copied over | 126 // method to the blob registry; that way the data is only copied over |
127 // into the renderer when it's actually read, not when the blob is | 127 // into the renderer when it's actually read, not when the blob is |
128 // initially constructed). | 128 // initially constructed). |
129 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(blink
::Platform::current()->clipboard()->readImage(blink::WebClipboard::BufferStandar
d)); | 129 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer>>(blink:
:Platform::current()->clipboard()->readImage(blink::WebClipboard::BufferStandard
)); |
130 OwnPtr<BlobData> blobData = BlobData::create(); | 130 OwnPtr<BlobData> blobData = BlobData::create(); |
131 blobData->appendBytes(data->data(), data->size()); | 131 blobData->appendBytes(data->data(), data->size()); |
132 blobData->setContentType(mimeTypeImagePng); | 132 blobData->setContentType(mimeTypeImagePng); |
133 return Blob::create(BlobDataHandle::create(blobData.release(), data->siz
e())); | 133 return Blob::create(BlobDataHandle::create(blobData.release(), data->siz
e())); |
134 } | 134 } |
135 | 135 |
136 return nullptr; | 136 return nullptr; |
137 } | 137 } |
138 | 138 |
139 String DataObjectItem::getAsString() const | 139 String DataObjectItem::getAsString() const |
(...skipping 27 matching lines...) Expand all Loading... |
167 // we'll need to make sure this works as expected for DragDataChromium. | 167 // we'll need to make sure this works as expected for DragDataChromium. |
168 return m_kind == FileKind && m_file; | 168 return m_kind == FileKind && m_file; |
169 } | 169 } |
170 | 170 |
171 DEFINE_TRACE(DataObjectItem) | 171 DEFINE_TRACE(DataObjectItem) |
172 { | 172 { |
173 visitor->trace(m_file); | 173 visitor->trace(m_file); |
174 } | 174 } |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
OLD | NEW |