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/ExecutionContext.h" |
8 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
9 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
10 #include "modules/presentation/PresentationConnection.h" | 11 #include "modules/presentation/PresentationConnection.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 #include "platform/heap/Heap.h" | |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 // Implements the PresentationConnectionList interface from the Presentation API | 16 // Implements the PresentationConnectionList interface from the Presentation API |
17 // from which represents set of presentation connections in the set of | 17 // from which represents set of presentation connections in the set of |
18 // presentation controllers. | 18 // presentation controllers. |
19 class MODULES_EXPORT PresentationConnectionList final | 19 class MODULES_EXPORT PresentationConnectionList final |
20 : public EventTargetWithInlineData { | 20 : public EventTargetWithInlineData, |
| 21 public ContextClient { |
21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnectionList); |
22 | 24 |
23 public: | 25 public: |
24 explicit PresentationConnectionList(ExecutionContext*); | 26 explicit PresentationConnectionList(ExecutionContext*); |
25 ~PresentationConnectionList() = default; | 27 ~PresentationConnectionList() = default; |
26 | 28 |
27 // EventTarget implementation. | 29 // EventTarget implementation. |
28 const AtomicString& interfaceName() const override; | 30 const AtomicString& interfaceName() const override; |
29 ExecutionContext* getExecutionContext() const override { | 31 ExecutionContext* getExecutionContext() const override { |
30 return m_executionContext; | 32 return ContextClient::getExecutionContext(); |
31 } | 33 } |
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(); |
40 | 42 |
41 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
42 | 44 |
43 protected: | 45 protected: |
44 // EventTarget implementation. | 46 // EventTarget implementation. |
45 void addedEventListener(const AtomicString& eventType, | 47 void addedEventListener(const AtomicString& eventType, |
46 RegisteredEventListener&) override; | 48 RegisteredEventListener&) override; |
47 | 49 |
48 private: | 50 private: |
49 friend class PresentationReceiverTest; | 51 friend class PresentationReceiverTest; |
50 | 52 |
51 HeapVector<Member<PresentationConnection>> m_connections; | 53 HeapVector<Member<PresentationConnection>> m_connections; |
52 Member<ExecutionContext> m_executionContext; | |
53 }; | 54 }; |
54 | 55 |
55 } // namespace blink | 56 } // namespace blink |
56 | 57 |
57 #endif // PresentationConnectionList_h | 58 #endif // PresentationConnectionList_h |
OLD | NEW |