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

Unified Diff: Source/core/platform/chromium/ChromiumDataObject.cpp

Issue 22837006: Have DataTransferItemList.add() methods return the added item (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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: Source/core/platform/chromium/ChromiumDataObject.cpp
diff --git a/Source/core/platform/chromium/ChromiumDataObject.cpp b/Source/core/platform/chromium/ChromiumDataObject.cpp
index 2c7fa1601a4f2c410f521a766efa974f41a2be12..a9a536dfcfa1a57266e2e8189c64443671506560 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.cpp
+++ b/Source/core/platform/chromium/ChromiumDataObject.cpp
@@ -90,18 +90,24 @@ void ChromiumDataObject::clearAll()
m_itemList.clear();
}
-void ChromiumDataObject::add(const String& data, const String& type, ExceptionState& es)
+PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(const String& data, const String& type, ExceptionState& es)
{
- if (!internalAddStringItem(ChromiumDataObjectItem::createFromString(type, data)))
+ RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromString(type, data);
+ if (!internalAddStringItem(item)) {
es.throwDOMException(NotSupportedError);
+ return 0;
+ }
+ return item;
}
-void ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context)
+PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context)
{
if (!file)
- return;
+ return 0;
- m_itemList.append(ChromiumDataObjectItem::createFromFile(file));
+ RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromFile(file);
+ m_itemList.append(item);
+ return item;
}
void ChromiumDataObject::clearData(const String& type)
« no previous file with comments | « Source/core/platform/chromium/ChromiumDataObject.h ('k') | Source/core/platform/chromium/ClipboardChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698