OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 ExistingPresentationConnectionCallbacks_h |
| 6 #define ExistingPresentationConnectionCallbacks_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "public/platform/WebCallbacks.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class PresentationConnection; |
| 15 class ScriptPromiseResolver; |
| 16 struct WebPresentationError; |
| 17 struct WebPresentationSessionInfo; |
| 18 |
| 19 // ExistingPresentationConnectionCallbacks extends WebCallbacks to resolve the |
| 20 // underlying promise. It takes the PresentationConnection object that |
| 21 // originated the call in its constructor and will resolve underlying promise |
| 22 // with that object. |
| 23 class ExistingPresentationConnectionCallbacks final |
| 24 : public WebCallbacks<const WebPresentationSessionInfo&, |
| 25 const WebPresentationError&> { |
| 26 public: |
| 27 ExistingPresentationConnectionCallbacks(ScriptPromiseResolver*, |
| 28 PresentationConnection*); |
| 29 ~ExistingPresentationConnectionCallbacks() override = default; |
| 30 |
| 31 void onSuccess(const WebPresentationSessionInfo&) override; |
| 32 void onError(const WebPresentationError&) override; |
| 33 |
| 34 private: |
| 35 Persistent<ScriptPromiseResolver> m_resolver; |
| 36 Persistent<PresentationConnection> m_connection; |
| 37 |
| 38 WTF_MAKE_NONCOPYABLE(ExistingPresentationConnectionCallbacks); |
| 39 }; |
| 40 |
| 41 } // namespace blink |
| 42 |
| 43 #endif // ExistingPresentationConnectionCallbacks_h |
OLD | NEW |