OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PresentationConnectionList_h | 5 #ifndef PresentationConnectionList_h |
6 #define PresentationConnectionList_h | 6 #define PresentationConnectionList_h |
7 | 7 |
8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
11 #include "modules/presentation/PresentationConnection.h" | 11 #include "modules/presentation/PresentationConnection.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "platform/heap/Heap.h" | 13 #include "platform/heap/Heap.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
| 17 class WebPresentationConnectionClient; |
| 18 |
17 // Implements the PresentationConnectionList interface from the Presentation API
from | 19 // Implements the PresentationConnectionList interface from the Presentation API
from |
18 // which represents set of presentation connections in the set of | 20 // which represents set of presentation connections in the set of |
19 // presentation controllers. | 21 // presentation controllers. |
20 class MODULES_EXPORT PresentationConnectionList final | 22 class MODULES_EXPORT PresentationConnectionList final |
21 : public EventTargetWithInlineData | 23 : public EventTargetWithInlineData |
22 , public ContextLifecycleObserver { | 24 , public ContextLifecycleObserver { |
23 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnectionList); | 25 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnectionList); |
24 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
25 public: | 27 public: |
26 explicit PresentationConnectionList(ExecutionContext*); | 28 explicit PresentationConnectionList(ExecutionContext*); |
27 ~PresentationConnectionList() = default; | 29 ~PresentationConnectionList() = default; |
28 | 30 |
29 // EventTarget implementation. | 31 // EventTarget implementation. |
30 const AtomicString& interfaceName() const override; | 32 const AtomicString& interfaceName() const override; |
31 ExecutionContext* getExecutionContext() const override; | 33 ExecutionContext* getExecutionContext() const override; |
32 | 34 |
33 // PresentationConnectionList.idl implementation. | 35 // PresentationConnectionList.idl implementation. |
34 const HeapVector<Member<PresentationConnection>>& connections() const; | 36 const HeapVector<Member<PresentationConnection>>& connections() const; |
35 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); | 37 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); |
36 | 38 |
37 void addConnection(PresentationConnection*); | 39 void addConnection(PresentationConnection*); |
38 void dispatchConnectionAvailableEvent(PresentationConnection*); | 40 void dispatchConnectionAvailableEvent(PresentationConnection*); |
39 bool isEmpty(); | 41 bool isEmpty(); |
| 42 PresentationConnection* findConnection(WebPresentationConnectionClient*); |
40 | 43 |
41 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
42 | 45 |
43 protected: | 46 protected: |
44 // EventTarget implementation. | 47 // EventTarget implementation. |
45 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; | 48 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; |
46 | 49 |
47 private: | 50 private: |
48 friend class PresentationReceiverTest; | 51 friend class PresentationReceiverTest; |
49 | 52 |
50 HeapVector<Member<PresentationConnection>> m_connections; | 53 HeapVector<Member<PresentationConnection>> m_connections; |
51 }; | 54 }; |
52 | 55 |
53 } // namespace blink | 56 } // namespace blink |
54 | 57 |
55 #endif // PresentationConnectionList_h | 58 #endif // PresentationConnectionList_h |
OLD | NEW |