| 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 "public/platform/modules/presentation/WebPresentationConnectionCallback
s.h" | 10 #include "public/platform/modules/presentation/WebPresentationConnectionCallback
s.h" |
| 11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class PresentationConnection; | 15 class PresentationConnection; |
| 16 class PresentationRequest; | 16 class PresentationRequest; |
| 17 class ScriptPromiseResolver; | 17 class ScriptPromiseResolver; |
| 18 struct WebPresentationSessionInfo; | |
| 19 struct WebPresentationError; | 18 struct WebPresentationError; |
| 19 struct WebPresentationInfo; |
| 20 | 20 |
| 21 // PresentationConnectionCallbacks extends WebCallbacks to resolve the | 21 // PresentationConnectionCallbacks extends WebCallbacks to resolve the |
| 22 // underlying promise depending on the result passed to the callback. It takes | 22 // underlying promise depending on the result passed to the callback. It takes |
| 23 // the PresentationRequest object that originated the call in its constructor | 23 // the PresentationRequest object that originated the call in its constructor |
| 24 // and will pass it to the created PresentationConnection. | 24 // and will pass it to the created PresentationConnection. |
| 25 class PresentationConnectionCallbacks final | 25 class PresentationConnectionCallbacks final |
| 26 : public WebPresentationConnectionCallbacks { | 26 : public WebPresentationConnectionCallbacks { |
| 27 public: | 27 public: |
| 28 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*); | 28 PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*); |
| 29 ~PresentationConnectionCallbacks() override = default; | 29 ~PresentationConnectionCallbacks() override = default; |
| 30 | 30 |
| 31 // WebCallbacks implementation | 31 // WebCallbacks implementation |
| 32 void onSuccess(const WebPresentationSessionInfo&) override; | 32 void onSuccess(const WebPresentationInfo&) override; |
| 33 void onError(const WebPresentationError&) override; | 33 void onError(const WebPresentationError&) override; |
| 34 | 34 |
| 35 // WebPresentationConnectionCallbacks implementation | 35 // WebPresentationConnectionCallbacks implementation |
| 36 WebPresentationConnection* getConnection() override; | 36 WebPresentationConnection* getConnection() override; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 Persistent<ScriptPromiseResolver> m_resolver; | 39 Persistent<ScriptPromiseResolver> m_resolver; |
| 40 Persistent<PresentationRequest> m_request; | 40 Persistent<PresentationRequest> m_request; |
| 41 WeakPersistent<PresentationConnection> m_connection; | 41 WeakPersistent<PresentationConnection> m_connection; |
| 42 | 42 |
| 43 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); | 43 WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace blink | 46 } // namespace blink |
| 47 | 47 |
| 48 #endif // PresentationConnectionCallbacks_h | 48 #endif // PresentationConnectionCallbacks_h |
| OLD | NEW |