| 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 PresentationReceiver_h | 5 #ifndef PresentationReceiver_h |
| 6 #define PresentationReceiver_h | 6 #define PresentationReceiver_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseProperty.h" | 9 #include "bindings/core/v8/ScriptPromiseProperty.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
| 12 #include "core/dom/DOMException.h" | 12 #include "core/dom/DOMException.h" |
| 13 #include "modules/ModulesExport.h" | 13 #include "modules/ModulesExport.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "platform/heap/Heap.h" | 15 #include "platform/heap/Heap.h" |
| 16 #include "public/platform/modules/presentation/WebPresentationReceiver.h" | 16 #include "public/platform/modules/presentation/WebPresentationReceiver.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class Document; | 20 class Document; |
| 21 class PresentationConnection; | 21 class PresentationConnection; |
| 22 class PresentationConnectionList; | 22 class PresentationConnectionList; |
| 23 class WebPresentationClient; | 23 class WebPresentationClient; |
| 24 | 24 |
| 25 // Implements the PresentationReceiver interface from the Presentation API from | 25 // Implements the PresentationReceiver interface from the Presentation API from |
| 26 // which websites can implement the receiving side of a presentation session. | 26 // which websites can implement the receiving side of a presentation. |
| 27 class MODULES_EXPORT PresentationReceiver final | 27 class MODULES_EXPORT PresentationReceiver final |
| 28 : public GarbageCollectedFinalized<PresentationReceiver>, | 28 : public GarbageCollectedFinalized<PresentationReceiver>, |
| 29 public ScriptWrappable, | 29 public ScriptWrappable, |
| 30 public ContextClient, | 30 public ContextClient, |
| 31 public WebPresentationReceiver { | 31 public WebPresentationReceiver { |
| 32 USING_GARBAGE_COLLECTED_MIXIN(PresentationReceiver); | 32 USING_GARBAGE_COLLECTED_MIXIN(PresentationReceiver); |
| 33 DEFINE_WRAPPERTYPEINFO(); | 33 DEFINE_WRAPPERTYPEINFO(); |
| 34 using ConnectionListProperty = | 34 using ConnectionListProperty = |
| 35 ScriptPromiseProperty<Member<PresentationReceiver>, | 35 ScriptPromiseProperty<Member<PresentationReceiver>, |
| 36 Member<PresentationConnectionList>, | 36 Member<PresentationConnectionList>, |
| 37 Member<DOMException>>; | 37 Member<DOMException>>; |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 explicit PresentationReceiver(LocalFrame*, WebPresentationClient*); | 40 explicit PresentationReceiver(LocalFrame*, WebPresentationClient*); |
| 41 ~PresentationReceiver() = default; | 41 ~PresentationReceiver() = default; |
| 42 | 42 |
| 43 // PresentationReceiver.idl implementation | 43 // PresentationReceiver.idl implementation |
| 44 ScriptPromise connectionList(ScriptState*); | 44 ScriptPromise connectionList(ScriptState*); |
| 45 | 45 |
| 46 // Implementation of WebPresentationController. | 46 // Implementation of WebPresentationController. |
| 47 WebPresentationConnection* onReceiverConnectionAvailable( | 47 WebPresentationConnection* onReceiverConnectionAvailable( |
| 48 const WebPresentationSessionInfo&) override; | 48 const WebPresentationInfo&) override; |
| 49 void didChangeSessionState(WebPresentationConnectionState) override; | 49 void didChangeConnectionState(WebPresentationConnectionState) override; |
| 50 void terminateConnection() override; | 50 void terminateConnection() override; |
| 51 | 51 |
| 52 void registerConnection(PresentationConnection*); | 52 void registerConnection(PresentationConnection*); |
| 53 | 53 |
| 54 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend class PresentationReceiverTest; | 57 friend class PresentationReceiverTest; |
| 58 | 58 |
| 59 void recordOriginTypeAccess(Document*) const; | 59 void recordOriginTypeAccess(Document*) const; |
| 60 | 60 |
| 61 Member<ConnectionListProperty> m_connectionListProperty; | 61 Member<ConnectionListProperty> m_connectionListProperty; |
| 62 Member<PresentationConnectionList> m_connectionList; | 62 Member<PresentationConnectionList> m_connectionList; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace blink | 65 } // namespace blink |
| 66 | 66 |
| 67 #endif // PresentationReceiver_h | 67 #endif // PresentationReceiver_h |
| OLD | NEW |