| 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 PresentationRequest; | 14 class PresentationRequest; |
| 15 class ScriptPromiseResolver; | 15 class ScriptPromiseResolver; |
| 16 class WebPresentationConnectionClient; | 16 class WebPresentationConnectionClient; |
| 17 struct WebPresentationError; | 17 struct WebPresentationError; |
| 18 | 18 |
| 19 // PresentationConnectionCallbacks extends WebCallbacks to resolve the | 19 // PresentationConnectionCallbacks extends WebCallbacks to resolve the |
| 20 // underlying promise depending on the result passed to the callback. It takes | 20 // underlying promise depending on the result passed to the callback. It takes |
| 21 // the PresentationRequest object that originated the call in its constructor | 21 // the PresentationRequest object that originated the call in its constructor |
| 22 // and will pass it to the created PresentationConnection. | 22 // and will pass it to the created PresentationConnection. |
| 23 class PresentationConnectionCallbacks final | 23 class PresentationConnectionCallbacks final |
| 24 : public WebCallbacks<WebPassOwnPtr<WebPresentationConnectionClient>, const
WebPresentationError&> { | 24 : public WebCallbacks<std::unique_ptr<WebPresentationConnectionClient>, cons
t WebPresentationError&> { |
| 25 public: | 25 public: |
| 26 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*
); | 26 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*
); |
| 27 ~PresentationConnectionCallbacks() override = default; | 27 ~PresentationConnectionCallbacks() override = default; |
| 28 | 28 |
| 29 void onSuccess(WebPassOwnPtr<WebPresentationConnectionClient>) override; | 29 void onSuccess(std::unique_ptr<WebPresentationConnectionClient>) override; |
| 30 void onError(const WebPresentationError&) override; | 30 void onError(const WebPresentationError&) override; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 Persistent<ScriptPromiseResolver> m_resolver; | 33 Persistent<ScriptPromiseResolver> m_resolver; |
| 34 Persistent<PresentationRequest> m_request; | 34 Persistent<PresentationRequest> m_request; |
| 35 | 35 |
| 36 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); | 36 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } // namespace blink | 39 } // namespace blink |
| 40 | 40 |
| 41 #endif // PresentationConnectionCallbacks_h | 41 #endif // PresentationConnectionCallbacks_h |
| OLD | NEW |