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

Unified Diff: third_party/WebKit/Source/core/clipboard/DataObject.cpp

Issue 2674953003: Only generate suggested filenames when actually dragging an image. (Closed)
Patch Set: rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/clipboard/DataObject.cpp
diff --git a/third_party/WebKit/Source/core/clipboard/DataObject.cpp b/third_party/WebKit/Source/core/clipboard/DataObject.cpp
index 87c4687c56db44f8b6c5af32d804f2a7b887147c..11b7d9d9a5142f7b4736059026f2b03be6f5fe68 100644
--- a/third_party/WebKit/Source/core/clipboard/DataObject.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataObject.cpp
@@ -222,10 +222,12 @@ void DataObject::addFilename(const String& filename,
File::createForUserProvidedFile(filename, displayName), fileSystemId));
}
-void DataObject::addSharedBuffer(const String& name,
- PassRefPtr<SharedBuffer> buffer) {
- internalAddFileItem(
- DataObjectItem::createFromSharedBuffer(name, std::move(buffer)));
+void DataObject::addSharedBuffer(PassRefPtr<SharedBuffer> buffer,
+ const KURL& sourceURL,
+ const String& filenameExtension,
+ const AtomicString& contentDisposition) {
+ internalAddFileItem(DataObjectItem::createFromSharedBuffer(
+ std::move(buffer), sourceURL, filenameExtension, contentDisposition));
}
DataObject::DataObject() : m_modifiers(0) {}
@@ -322,10 +324,15 @@ WebDragData DataObject::toWebDragData() {
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = originalItem->type();
item.stringData = originalItem->getAsString();
+ item.title = originalItem->title();
+ item.baseURL = originalItem->baseURL();
} else if (originalItem->kind() == DataObjectItem::FileKind) {
if (originalItem->sharedBuffer()) {
item.storageType = WebDragData::Item::StorageTypeBinaryData;
item.binaryData = originalItem->sharedBuffer();
+ item.binaryDataSourceURL = originalItem->baseURL();
+ item.binaryDataFilenameExtension = originalItem->filenameExtension();
+ item.binaryDataContentDisposition = originalItem->title();
} else if (originalItem->isFilename()) {
Blob* blob = originalItem->getAsFile();
if (blob->isFile()) {
@@ -355,8 +362,6 @@ WebDragData DataObject::toWebDragData() {
} else {
ASSERT_NOT_REACHED();
}
- item.title = originalItem->title();
- item.baseURL = originalItem->baseURL();
itemList[i] = item;
}
data.swapItems(itemList);
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataObject.h ('k') | third_party/WebKit/Source/core/clipboard/DataObjectItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698