| 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 PresentationRequest_h | 5 #ifndef PresentationRequest_h |
| 6 #define PresentationRequest_h | 6 #define PresentationRequest_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "core/dom/ContextLifecycleObserver.h" | 10 #include "core/dom/ContextLifecycleObserver.h" |
| 11 #include "core/events/EventTarget.h" | 11 #include "core/events/EventTarget.h" |
| 12 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
| 13 #include "modules/presentation/PresentationPromiseProperty.h" | 13 #include "modules/presentation/PresentationPromiseProperty.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 "platform/weborigin/KURL.h" | 16 #include "platform/weborigin/KURL.h" |
| 17 #include "wtf/Vector.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 // Implements the PresentationRequest interface from the Presentation API from | 21 // Implements the PresentationRequest interface from the Presentation API from |
| 21 // which websites can start or join presentation connections. | 22 // which websites can start or join presentation connections. |
| 22 class MODULES_EXPORT PresentationRequest final | 23 class MODULES_EXPORT PresentationRequest final |
| 23 : public EventTargetWithInlineData, | 24 : public EventTargetWithInlineData, |
| 24 public ActiveScriptWrappable<PresentationRequest>, | 25 public ActiveScriptWrappable<PresentationRequest>, |
| 25 public ContextLifecycleObserver { | 26 public ContextLifecycleObserver { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(PresentationRequest); | 27 USING_GARBAGE_COLLECTED_MIXIN(PresentationRequest); |
| 27 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
| 28 | 29 |
| 29 public: | 30 public: |
| 30 ~PresentationRequest() = default; | 31 ~PresentationRequest() = default; |
| 31 | 32 |
| 32 static PresentationRequest* create(ExecutionContext*, | 33 static PresentationRequest* create(ExecutionContext*, |
| 33 const String& url, | 34 const String& url, |
| 34 ExceptionState&); | 35 ExceptionState&); |
| 36 static PresentationRequest* create(ExecutionContext*, |
| 37 const Vector<String>& urls, |
| 38 ExceptionState&); |
| 35 | 39 |
| 36 // EventTarget implementation. | 40 // EventTarget implementation. |
| 37 const AtomicString& interfaceName() const override; | 41 const AtomicString& interfaceName() const override; |
| 38 ExecutionContext* getExecutionContext() const override; | 42 ExecutionContext* getExecutionContext() const override; |
| 39 | 43 |
| 40 // ScriptWrappable implementation. | 44 // ScriptWrappable implementation. |
| 41 bool hasPendingActivity() const final; | 45 bool hasPendingActivity() const final; |
| 42 | 46 |
| 43 ScriptPromise start(ScriptState*); | 47 ScriptPromise start(ScriptState*); |
| 44 ScriptPromise reconnect(ScriptState*, const String& id); | 48 ScriptPromise reconnect(ScriptState*, const String& id); |
| 45 ScriptPromise getAvailability(ScriptState*); | 49 ScriptPromise getAvailability(ScriptState*); |
| 46 | 50 |
| 47 const KURL& url() const; | 51 const Vector<KURL>& urls() const; |
| 48 | 52 |
| 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); | 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); |
| 50 | 54 |
| 51 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
| 52 | 56 |
| 53 protected: | 57 protected: |
| 54 // EventTarget implementation. | 58 // EventTarget implementation. |
| 55 void addedEventListener(const AtomicString& eventType, | 59 void addedEventListener(const AtomicString& eventType, |
| 56 RegisteredEventListener&) override; | 60 RegisteredEventListener&) override; |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 PresentationRequest(ExecutionContext*, const KURL&); | 63 PresentationRequest(ExecutionContext*, const Vector<KURL>&); |
| 60 | 64 |
| 61 Member<PresentationAvailabilityProperty> m_availabilityProperty; | 65 Member<PresentationAvailabilityProperty> m_availabilityProperty; |
| 62 KURL m_url; | 66 Vector<KURL> m_urls; |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 } // namespace blink | 69 } // namespace blink |
| 66 | 70 |
| 67 #endif // PresentationRequest_h | 71 #endif // PresentationRequest_h |
| OLD | NEW |