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

Unified Diff: third_party/WebKit/Source/core/clipboard/ClipboardAsync.h

Issue 2695593006: Initial stub version of Async Clipboard API (Closed)
Patch Set: 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/ClipboardAsync.h
diff --git a/third_party/WebKit/Source/core/clipboard/ClipboardAsync.h b/third_party/WebKit/Source/core/clipboard/ClipboardAsync.h
new file mode 100644
index 0000000000000000000000000000000000000000..98b8990a6cdeda07086e988079e728847ca42ff4
--- /dev/null
+++ b/third_party/WebKit/Source/core/clipboard/ClipboardAsync.h
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ClipboardAsync_h
+#define ClipboardAsync_h
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "core/CoreExport.h"
+#include "core/dom/ContextLifecycleObserver.h"
+#include "public/platform/WebClipboard.h"
+
+namespace blink {
+
+class DataTransfer;
+class ScriptPromiseResolver;
+
+class CORE_EXPORT ClipboardAsync final
+ : public GarbageCollectedFinalized<ClipboardAsync>,
+ public ContextLifecycleObserver {
+ USING_GARBAGE_COLLECTED_MIXIN(ClipboardAsync);
+
+ public:
+ virtual ~ClipboardAsync(){};
+
+ static ClipboardAsync* create(ScriptState*);
+
+ ScriptPromise scheduleRead();
+ ScriptPromise scheduleReadText();
+
+ ScriptPromise scheduleWrite(DataTransfer*);
+ ScriptPromise scheduleWriteText(const String&);
+
+ // ContextLifecycleObserver
+ void contextDestroyed(ExecutionContext*) override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ ClipboardAsync(ScriptState*);
+
+ WebTaskRunner* getTaskRunner();
+
+ void handleRead();
+ void handleReadText();
+
+ void handleWrite(DataTransfer*);
+ void handleWriteText(const String&);
+
+ Member<ScriptPromiseResolver> m_scriptPromiseResolver;
+
+ WebClipboard::Buffer m_buffer;
+};
+
+} // namespace blink
+
+#endif // ClipboardAsync_h

Powered by Google App Engine
This is Rietveld 408576698