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 PresentationSessionClientCallbacks_h |
| 6 #define PresentationSessionClientCallbacks_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/PassRefPtr.h" |
| 12 #include "wtf/RefPtr.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class Presentation; |
| 17 class ScriptPromiseResolver; |
| 18 |
| 19 // The implementation of the WebCallbacks interface passed to the embedder to |
| 20 // get the result of start/joinSession() calls. Will in its turn resolve the |
| 21 // corresponding Promise given to the frame. |
| 22 // When creating the session succeeds, onSuccess() is invoked with the |
| 23 // implementation of the WebPresentationSessionClient interface. If creating the |
| 24 // session fails, onError() is invoked with the implementation of the |
| 25 // WebPresentationError interface. |
| 26 // Owned by the receiver of the callback and must be deleted after use. |
| 27 class PresentationSessionClientCallbacks final : public WebPresentationSessionCl
ientCallbacks { |
| 28 WTF_MAKE_NONCOPYABLE(PresentationSessionClientCallbacks); |
| 29 public: |
| 30 PresentationSessionClientCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResol
ver>, Presentation*); |
| 31 virtual ~PresentationSessionClientCallbacks(); |
| 32 |
| 33 // WebPresentationSessionClientCallbacks implementation. |
| 34 virtual void onSuccess(WebPresentationSessionClient*) override; |
| 35 virtual void onError(WebPresentationError*) override; |
| 36 |
| 37 private: |
| 38 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 39 Persistent<Presentation> m_presentation; |
| 40 }; |
| 41 |
| 42 } // namespace blink |
| 43 |
| 44 #endif // PresentationSessionClientCallbacks_h |
OLD | NEW |