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