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