| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 m_sequenceNumber(sequenceNumber) {} | 98 m_sequenceNumber(sequenceNumber) {} |
| 99 | 99 |
| 100 Blob* DataObjectItem::getAsFile() const { | 100 Blob* DataObjectItem::getAsFile() const { |
| 101 if (kind() != FileKind) | 101 if (kind() != FileKind) |
| 102 return nullptr; | 102 return nullptr; |
| 103 | 103 |
| 104 if (m_source == InternalSource) { | 104 if (m_source == InternalSource) { |
| 105 if (m_file) | 105 if (m_file) |
| 106 return m_file.get(); | 106 return m_file.get(); |
| 107 ASSERT(m_sharedBuffer); | 107 ASSERT(m_sharedBuffer); |
| 108 // FIXME: This code is currently impossible--we never populate m_sharedBuffe
r when dragging | 108 // FIXME: This code is currently impossible--we never populate |
| 109 // in. At some point though, we may need to support correctly converting a s
hared buffer | 109 // m_sharedBuffer when dragging in. At some point though, we may need to |
| 110 // into a file. | 110 // support correctly converting a shared buffer into a file. |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 | 113 |
| 114 ASSERT(m_source == PasteboardSource); | 114 ASSERT(m_source == PasteboardSource); |
| 115 if (type() == mimeTypeImagePng) { | 115 if (type() == mimeTypeImagePng) { |
| 116 WebBlobInfo blobInfo = Platform::current()->clipboard()->readImage( | 116 WebBlobInfo blobInfo = Platform::current()->clipboard()->readImage( |
| 117 WebClipboard::BufferStandard); | 117 WebClipboard::BufferStandard); |
| 118 if (blobInfo.size() < 0) | 118 if (blobInfo.size() < 0) |
| 119 return nullptr; | 119 return nullptr; |
| 120 return Blob::create(BlobDataHandle::create(blobInfo.uuid(), blobInfo.type(), | 120 return Blob::create(BlobDataHandle::create(blobInfo.uuid(), blobInfo.type(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 148 data = Platform::current()->clipboard()->readCustomData(buffer, m_type); | 148 data = Platform::current()->clipboard()->readCustomData(buffer, m_type); |
| 149 } | 149 } |
| 150 | 150 |
| 151 return Platform::current()->clipboard()->sequenceNumber(buffer) == | 151 return Platform::current()->clipboard()->sequenceNumber(buffer) == |
| 152 m_sequenceNumber | 152 m_sequenceNumber |
| 153 ? data | 153 ? data |
| 154 : String(); | 154 : String(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool DataObjectItem::isFilename() const { | 157 bool DataObjectItem::isFilename() const { |
| 158 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly supp
ort File dragout, | 158 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly |
| 159 // we'll need to make sure this works as expected for DragDataChromium. | 159 // support File dragout, we'll need to make sure this works as expected for |
| 160 // DragDataChromium. |
| 160 return m_kind == FileKind && m_file; | 161 return m_kind == FileKind && m_file; |
| 161 } | 162 } |
| 162 | 163 |
| 163 DEFINE_TRACE(DataObjectItem) { | 164 DEFINE_TRACE(DataObjectItem) { |
| 164 visitor->trace(m_file); | 165 visitor->trace(m_file); |
| 165 } | 166 } |
| 166 | 167 |
| 167 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |