| 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. | 26 // which websites can implement the receiving side of a presentation. This needs |
| 27 // to be eagerly created in order to have the receiver associated with the |
| 28 // client. |
| 27 class MODULES_EXPORT PresentationReceiver final | 29 class MODULES_EXPORT PresentationReceiver final |
| 28 : public GarbageCollectedFinalized<PresentationReceiver>, | 30 : public GarbageCollectedFinalized<PresentationReceiver>, |
| 29 public ScriptWrappable, | 31 public ScriptWrappable, |
| 30 public ContextClient, | 32 public ContextClient, |
| 31 public WebPresentationReceiver { | 33 public WebPresentationReceiver { |
| 32 USING_GARBAGE_COLLECTED_MIXIN(PresentationReceiver); | 34 USING_GARBAGE_COLLECTED_MIXIN(PresentationReceiver); |
| 33 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
| 34 using ConnectionListProperty = | 36 using ConnectionListProperty = |
| 35 ScriptPromiseProperty<Member<PresentationReceiver>, | 37 ScriptPromiseProperty<Member<PresentationReceiver>, |
| 36 Member<PresentationConnectionList>, | 38 Member<PresentationConnectionList>, |
| 37 Member<DOMException>>; | 39 Member<DOMException>>; |
| 38 | 40 |
| 39 public: | 41 public: |
| 40 explicit PresentationReceiver(LocalFrame*, WebPresentationClient*); | 42 PresentationReceiver(LocalFrame*, WebPresentationClient*); |
| 41 ~PresentationReceiver() = default; | 43 ~PresentationReceiver() = default; |
| 42 | 44 |
| 45 static PresentationReceiver* From(Document&); |
| 46 |
| 43 // PresentationReceiver.idl implementation | 47 // PresentationReceiver.idl implementation |
| 44 ScriptPromise connectionList(ScriptState*); | 48 ScriptPromise connectionList(ScriptState*); |
| 45 | 49 |
| 46 // Implementation of WebPresentationController. | 50 // Implementation of WebPresentationController. |
| 47 WebPresentationConnection* OnReceiverConnectionAvailable( | 51 WebPresentationConnection* OnReceiverConnectionAvailable( |
| 48 const WebPresentationInfo&) override; | 52 const WebPresentationInfo&) override; |
| 49 void DidChangeConnectionState(WebPresentationConnectionState) override; | 53 void DidChangeConnectionState(WebPresentationConnectionState) override; |
| 50 void TerminateConnection() override; | 54 void TerminateConnection() override; |
| 51 | 55 |
| 52 void RegisterConnection(PresentationConnection*); | 56 void RegisterConnection(PresentationConnection*); |
| 53 | 57 |
| 54 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
| 55 | 59 |
| 56 private: | 60 private: |
| 57 friend class PresentationReceiverTest; | 61 friend class PresentationReceiverTest; |
| 58 | 62 |
| 59 void RecordOriginTypeAccess(Document*) const; | 63 void RecordOriginTypeAccess(Document*) const; |
| 60 | 64 |
| 61 Member<ConnectionListProperty> connection_list_property_; | 65 Member<ConnectionListProperty> connection_list_property_; |
| 62 Member<PresentationConnectionList> connection_list_; | 66 Member<PresentationConnectionList> connection_list_; |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 } // namespace blink | 69 } // namespace blink |
| 66 | 70 |
| 67 #endif // PresentationReceiver_h | 71 #endif // PresentationReceiver_h |
| OLD | NEW |