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 ClipboardPromise_h |
| 6 #define ClipboardPromise_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 ClipboardPromise final |
| 19 : public GarbageCollectedFinalized<ClipboardPromise>, |
| 20 public ContextLifecycleObserver { |
| 21 USING_GARBAGE_COLLECTED_MIXIN(ClipboardPromise); |
| 22 WTF_MAKE_NONCOPYABLE(ClipboardPromise); |
| 23 |
| 24 public: |
| 25 virtual ~ClipboardPromise(){}; |
| 26 |
| 27 static ScriptPromise CreateForRead(ScriptState*); |
| 28 static ScriptPromise CreateForReadText(ScriptState*); |
| 29 static ScriptPromise CreateForWrite(ScriptState*, DataTransfer*); |
| 30 static ScriptPromise CreateForWriteText(ScriptState*, const String&); |
| 31 |
| 32 DECLARE_VIRTUAL_TRACE(); |
| 33 |
| 34 private: |
| 35 ClipboardPromise(ScriptState*); |
| 36 |
| 37 WebTaskRunner* GetTaskRunner(); |
| 38 |
| 39 void HandleRead(); |
| 40 void HandleReadText(); |
| 41 |
| 42 void HandleWrite(DataTransfer*); |
| 43 void HandleWriteText(const String&); |
| 44 |
| 45 Member<ScriptPromiseResolver> script_promise_resolver_; |
| 46 |
| 47 WebClipboard::Buffer buffer_; |
| 48 }; |
| 49 |
| 50 } // namespace blink |
| 51 |
| 52 #endif // ClipboardPromise_h |
OLD | NEW |