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 PresentationConnectionCallbacks_h | 5 #ifndef PresentationConnectionCallbacks_h |
6 #define PresentationConnectionCallbacks_h | 6 #define PresentationConnectionCallbacks_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 "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class PresentationConnection; | |
14 class PresentationRequest; | 15 class PresentationRequest; |
15 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
16 class WebPresentationConnectionClient; | 17 class WebPresentationConnectionClient; |
17 struct WebPresentationError; | 18 struct WebPresentationError; |
18 | 19 |
19 // PresentationConnectionCallbacks extends WebCallbacks to resolve the | 20 // PresentationConnectionCallbacks extends WebCallbacks to resolve the |
20 // underlying promise depending on the result passed to the callback. It takes | 21 // underlying promise depending on the result passed to the callback. It takes |
21 // the PresentationRequest object that originated the call in its constructor | 22 // the PresentationRequest object that originated the call in its constructor |
22 // and will pass it to the created PresentationConnection. | 23 // and will pass it to the created PresentationConnection. |
23 class PresentationConnectionCallbacks final | 24 class PresentationConnectionCallbacks final |
24 : public WebCallbacks<std::unique_ptr<WebPresentationConnectionClient>, | 25 : public WebCallbacks<std::unique_ptr<WebPresentationConnectionClient>, |
25 const WebPresentationError&> { | 26 const WebPresentationError&> { |
26 public: | 27 public: |
27 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*); | 28 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*); |
28 ~PresentationConnectionCallbacks() override = default; | 29 ~PresentationConnectionCallbacks() override = default; |
29 | 30 |
30 void onSuccess(std::unique_ptr<WebPresentationConnectionClient>) override; | 31 void onSuccess(std::unique_ptr<WebPresentationConnectionClient>) override; |
31 void onError(const WebPresentationError&) override; | 32 void onError(const WebPresentationError&) override; |
32 | 33 |
33 private: | 34 private: |
34 Persistent<ScriptPromiseResolver> m_resolver; | 35 Persistent<ScriptPromiseResolver> m_resolver; |
35 Persistent<PresentationRequest> m_request; | 36 Persistent<PresentationRequest> m_request; |
36 | 37 |
37 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); | 38 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); |
38 }; | 39 }; |
39 | 40 |
41 // ExistingPresentationConnectionCallbacks extends WebCallbacks to resolve the | |
42 // underlying promise. It takes the PresentationConnection object that | |
43 // originated the call in its constructor and will resolve underlying promise | |
44 // with that object. | |
45 class ExistingPresentationConnectionCallbacks final | |
mlamouri (slow - plz ping)
2017/01/03 12:02:11
Can you create a new file for this callback maybe?
zhaobin
2017/01/03 20:12:07
Done.
| |
46 : public WebCallbacks<std::unique_ptr<WebPresentationConnectionClient>, | |
47 const WebPresentationError&> { | |
48 public: | |
49 ExistingPresentationConnectionCallbacks(ScriptPromiseResolver*, | |
50 PresentationConnection*); | |
51 ~ExistingPresentationConnectionCallbacks() override = default; | |
52 | |
53 void onSuccess(std::unique_ptr<WebPresentationConnectionClient>) override; | |
54 void onError(const WebPresentationError&) override; | |
55 | |
56 private: | |
57 Persistent<ScriptPromiseResolver> m_resolver; | |
58 Persistent<PresentationConnection> m_connection; | |
59 | |
60 WTF_MAKE_NONCOPYABLE(ExistingPresentationConnectionCallbacks); | |
61 }; | |
62 | |
40 } // namespace blink | 63 } // namespace blink |
41 | 64 |
42 #endif // PresentationConnectionCallbacks_h | 65 #endif // PresentationConnectionCallbacks_h |
OLD | NEW |