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

Unified Diff: Source/core/events/ClipboardEvent.cpp

Issue 1178683007: Introducing ClipboardEvent Constructor Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/events/ClipboardEvent.cpp
diff --git a/Source/core/events/ClipboardEvent.cpp b/Source/core/events/ClipboardEvent.cpp
index 22992c3ec0003cbf721a7f75cc516b4f503e4714..f857fc566babeeea7c030a0131b8cbd0c4bc8cfa 100644
--- a/Source/core/events/ClipboardEvent.cpp
+++ b/Source/core/events/ClipboardEvent.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "core/events/ClipboardEvent.h"
+#include "core/clipboard/DataObject.h"
namespace blink {
@@ -34,6 +35,19 @@ ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bo
{
}
+ClipboardEvent::ClipboardEvent(const AtomicString& type, const ClipboardEventInit& initializer)
+ : Event(type, initializer)
+{
+ DataTransferAccessPolicy policy = DataTransferNumb;
+
+ if (type == EventTypeNames::copy || type == EventTypeNames::cut || type == EventTypeNames::paste)
+ policy = DataTransferWritable;
+
+ m_clipboardData = DataTransfer::create(DataTransfer::CopyAndPaste, policy, DataObject::create());
+ if (initializer.hasDataType())
philipj_slow 2015/06/26 22:37:44 The hasDataType() isn't needed because this member
+ m_clipboardData->setData(initializer.dataType(), initializer.data());
+}
+
ClipboardEvent::~ClipboardEvent()
{
}

Powered by Google App Engine
This is Rietveld 408576698