OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ClipboardAsync_h |
| 6 #define ClipboardAsync_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/ContextLifecycleObserver.h" |
| 11 #include "public/platform/WebClipboard.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class DataTransfer; |
| 16 class ScriptPromiseResolver; |
| 17 |
| 18 class CORE_EXPORT ClipboardAsync final |
| 19 : public GarbageCollectedFinalized<ClipboardAsync>, |
| 20 public ContextLifecycleObserver { |
| 21 USING_GARBAGE_COLLECTED_MIXIN(ClipboardAsync); |
| 22 |
| 23 public: |
| 24 virtual ~ClipboardAsync(){}; |
| 25 |
| 26 static ClipboardAsync* create(ScriptState*); |
| 27 |
| 28 ScriptPromise scheduleRead(); |
| 29 ScriptPromise scheduleReadText(); |
| 30 |
| 31 ScriptPromise scheduleWrite(DataTransfer*); |
| 32 ScriptPromise scheduleWriteText(const String&); |
| 33 |
| 34 // ContextLifecycleObserver |
| 35 void contextDestroyed(ExecutionContext*) override; |
| 36 |
| 37 DECLARE_VIRTUAL_TRACE(); |
| 38 |
| 39 private: |
| 40 ClipboardAsync(ScriptState*); |
| 41 |
| 42 WebTaskRunner* getTaskRunner(); |
| 43 |
| 44 void handleRead(); |
| 45 void handleReadText(); |
| 46 |
| 47 void handleWrite(DataTransfer*); |
| 48 void handleWriteText(const String&); |
| 49 |
| 50 Member<ScriptPromiseResolver> m_scriptPromiseResolver; |
| 51 |
| 52 WebClipboard::Buffer m_buffer; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // ClipboardAsync_h |
OLD | NEW |