Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/core/platform/chromium/ChromiumDataObjectItem.cpp

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // improvements to this code (in particular, add a registerClipboardBlob 138 // improvements to this code (in particular, add a registerClipboardBlob
139 // method to the blob registry; that way the data is only copied over 139 // method to the blob registry; that way the data is only copied over
140 // into the renderer when it's actually read, not when the blob is 140 // into the renderer when it's actually read, not when the blob is
141 // initially constructed). 141 // initially constructed).
142 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(WebKi t::Platform::current()->clipboard()->readImage(WebKit::WebClipboard::BufferStand ard)); 142 RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(WebKi t::Platform::current()->clipboard()->readImage(WebKit::WebClipboard::BufferStand ard));
143 RefPtr<RawData> rawData = RawData::create(); 143 RefPtr<RawData> rawData = RawData::create();
144 rawData->mutableData()->append(data->data(), data->size()); 144 rawData->mutableData()->append(data->data(), data->size());
145 OwnPtr<BlobData> blobData = BlobData::create(); 145 OwnPtr<BlobData> blobData = BlobData::create();
146 blobData->appendData(rawData, 0, -1); 146 blobData->appendData(rawData, 0, -1);
147 blobData->setContentType(mimeTypeImagePng); 147 blobData->setContentType(mimeTypeImagePng);
148 return Blob::create(blobData.release(), data->size()); 148 return Blob::create(BlobDataHandle::create(blobData.release(), data->siz e()));
149 } 149 }
150 150
151 return 0; 151 return 0;
152 } 152 }
153 153
154 String ChromiumDataObjectItem::internalGetAsString() const 154 String ChromiumDataObjectItem::internalGetAsString() const
155 { 155 {
156 ASSERT(m_kind == DataTransferItem::kindString); 156 ASSERT(m_kind == DataTransferItem::kindString);
157 157
158 if (m_source == InternalSource) 158 if (m_source == InternalSource)
(...skipping 17 matching lines...) Expand all
176 176
177 bool ChromiumDataObjectItem::isFilename() const 177 bool ChromiumDataObjectItem::isFilename() const
178 { 178 {
179 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout, 179 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout,
180 // we'll need to make sure this works as expected for DragDataChromium. 180 // we'll need to make sure this works as expected for DragDataChromium.
181 return m_kind == DataTransferItem::kindFile && m_file; 181 return m_kind == DataTransferItem::kindFile && m_file;
182 } 182 }
183 183
184 } // namespace WebCore 184 } // namespace WebCore
185 185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698