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(zhaobin): combine this class with PresentationConnectionCallbacks. | |
mark a. foltz
2017/01/23 20:18:42
Can you file a crbug to track this and change this
zhaobin
2017/01/24 01:23:24
Done.
| |
23 class ExistingPresentationConnectionCallbacks final | 25 class ExistingPresentationConnectionCallbacks final |
24 : public WebCallbacks<const WebPresentationSessionInfo&, | 26 : public WebPresentationConnectionCallbacks { |
25 const WebPresentationError&> { | |
26 public: | 27 public: |
27 ExistingPresentationConnectionCallbacks(ScriptPromiseResolver*, | 28 ExistingPresentationConnectionCallbacks(ScriptPromiseResolver*, |
28 PresentationConnection*); | 29 PresentationConnection*); |
29 ~ExistingPresentationConnectionCallbacks() override = default; | 30 ~ExistingPresentationConnectionCallbacks() override = default; |
30 | 31 |
32 // WebCallbacks implementation | |
31 void onSuccess(const WebPresentationSessionInfo&) override; | 33 void onSuccess(const WebPresentationSessionInfo&) override; |
32 void onError(const WebPresentationError&) override; | 34 void onError(const WebPresentationError&) override; |
33 | 35 |
36 // WebPresentationConnectionCallbacks implementation | |
37 WebPresentationConnection* getConnection() override; | |
38 | |
34 private: | 39 private: |
35 Persistent<ScriptPromiseResolver> m_resolver; | 40 Persistent<ScriptPromiseResolver> m_resolver; |
36 Persistent<PresentationConnection> m_connection; | 41 Persistent<PresentationConnection> m_connection; |
37 | 42 |
38 WTF_MAKE_NONCOPYABLE(ExistingPresentationConnectionCallbacks); | 43 WTF_MAKE_NONCOPYABLE(ExistingPresentationConnectionCallbacks); |
39 }; | 44 }; |
40 | 45 |
41 } // namespace blink | 46 } // namespace blink |
42 | 47 |
43 #endif // ExistingPresentationConnectionCallbacks_h | 48 #endif // ExistingPresentationConnectionCallbacks_h |
OLD | NEW |