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

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

Issue 2695593006: Initial stub version of Async Clipboard API (Closed)
Patch Set: Add WPTs; Update naming conventions; Review comments Created 3 years, 7 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..122c7f2e040d0e355b2ae48ef8358dbbe5213321
--- /dev/null
+++ b/third_party/WebKit/Source/core/clipboard/ClipboardAsync.h
@@ -0,0 +1,58 @@
+// 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
dcheng 2017/05/13 22:18:32 My main question about this is stylistic: this see
garykac 2017/05/17 23:51:14 Re: The name. That's a good point that I hadn't co
+ : public GarbageCollectedFinalized<ClipboardAsync>,
+ public ContextLifecycleObserver {
+ USING_GARBAGE_COLLECTED_MIXIN(ClipboardAsync);
+ WTF_MAKE_NONCOPYABLE(ClipboardAsync);
+
+ public:
+ virtual ~ClipboardAsync(){};
+
+ static ClipboardAsync* create(ScriptState*);
dcheng 2017/05/13 22:18:32 Nit: to follow the updated style guide, these shou
garykac 2017/05/17 23:51:14 Done.
+
+ 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;
dcheng 2017/05/13 22:18:32 Similarly, this should be buffer_
garykac 2017/05/17 23:51:14 Done.
+};
+
+} // namespace blink
+
+#endif // ClipboardAsync_h

Powered by Google App Engine
This is Rietveld 408576698