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

Unified Diff: Source/core/platform/chromium/ClipboardChromium.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
« no previous file with comments | « Source/core/platform/chromium/ChromiumDataObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/chromium/ClipboardChromium.cpp
diff --git a/Source/core/platform/chromium/ClipboardChromium.cpp b/Source/core/platform/chromium/ClipboardChromium.cpp
index 52d546193c2938c231b6aa74a99b3df641ed3394..48b258c7a0d5cf13f523306bdb6713c587a9443b 100644
--- a/Source/core/platform/chromium/ClipboardChromium.cpp
+++ b/Source/core/platform/chromium/ClipboardChromium.cpp
@@ -64,8 +64,8 @@ public:
virtual PassRefPtr<DataTransferItem> item(unsigned long index) OVERRIDE;
virtual void deleteItem(unsigned long index, ExceptionState&) OVERRIDE;
virtual void clear() OVERRIDE;
- virtual void add(const String& data, const String& type, ExceptionState&) OVERRIDE;
- virtual void add(PassRefPtr<File>) OVERRIDE;
+ virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) OVERRIDE;
+ virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) OVERRIDE;
private:
DataTransferItemListPolicyWrapper(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObject>);
@@ -119,18 +119,24 @@ void DataTransferItemListPolicyWrapper::clear()
m_dataObject->clearAll();
}
-void DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es)
+PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es)
{
if (!m_clipboard->canWriteData())
- return;
- m_dataObject->add(data, type, es);
+ return 0;
+ RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(data, type, es);
+ if (!item)
+ return 0;
+ return DataTransferItemPolicyWrapper::create(m_clipboard, item);
}
-void DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file)
+PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file)
{
if (!m_clipboard->canWriteData())
- return;
- m_dataObject->add(file, m_clipboard->frame()->document()->scriptExecutionContext());
+ return 0;
+ RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(file, m_clipboard->frame()->document()->scriptExecutionContext());
+ if (!item)
+ return 0;
+ return DataTransferItemPolicyWrapper::create(m_clipboard, item);
}
DataTransferItemListPolicyWrapper::DataTransferItemListPolicyWrapper(
« no previous file with comments | « Source/core/platform/chromium/ChromiumDataObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698