| 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/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "core/dom/ActiveDOMObject.h" | 10 #include "core/dom/ActiveDOMObject.h" |
| 10 #include "core/events/EventTarget.h" | 11 #include "core/events/EventTarget.h" |
| 11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 12 #include "platform/heap/Heap.h" | 13 #include "platform/heap/Heap.h" |
| 13 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 // Implements the PresentationRequest interface from the Presentation API from | 18 // Implements the PresentationRequest interface from the Presentation API from |
| 18 // which websites can start or join presentation connections. | 19 // which websites can start or join presentation connections. |
| 19 class PresentationRequest final | 20 class PresentationRequest final |
| 20 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationReq
uest> | 21 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationReq
uest> |
| 22 , public ActiveScriptWrappable |
| 21 , public ActiveDOMObject { | 23 , public ActiveDOMObject { |
| 22 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationRequest); | 24 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationRequest); |
| 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationRequest); | 25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationRequest); |
| 24 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 25 public: | 27 public: |
| 26 ~PresentationRequest() = default; | 28 ~PresentationRequest() = default; |
| 27 | 29 |
| 28 static PresentationRequest* create(ExecutionContext*, const String& url, Exc
eptionState&); | 30 static PresentationRequest* create(ExecutionContext*, const String& url, Exc
eptionState&); |
| 29 | 31 |
| 30 // EventTarget implementation. | 32 // EventTarget implementation. |
| 31 const AtomicString& interfaceName() const override; | 33 const AtomicString& interfaceName() const override; |
| 32 ExecutionContext* getExecutionContext() const override; | 34 ExecutionContext* getExecutionContext() const override; |
| 33 | 35 |
| 34 // ActiveDOMObject implementation. | 36 // ActiveScriptWrappable implementation. |
| 35 bool hasPendingActivity() const; | 37 bool hasPendingActivity() const final; |
| 36 | 38 |
| 37 ScriptPromise start(ScriptState*); | 39 ScriptPromise start(ScriptState*); |
| 38 ScriptPromise reconnect(ScriptState*, const String& id); | 40 ScriptPromise reconnect(ScriptState*, const String& id); |
| 39 ScriptPromise getAvailability(ScriptState*); | 41 ScriptPromise getAvailability(ScriptState*); |
| 40 | 42 |
| 41 const KURL& url() const; | 43 const KURL& url() const; |
| 42 | 44 |
| 43 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); | 45 DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable); |
| 44 | 46 |
| 45 DECLARE_VIRTUAL_TRACE(); | 47 DECLARE_VIRTUAL_TRACE(); |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 // EventTarget implementation. | 50 // EventTarget implementation. |
| 49 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB
eRawPtr<EventListener>, const EventListenerOptions&) override; | 51 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB
eRawPtr<EventListener>, const EventListenerOptions&) override; |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 PresentationRequest(ExecutionContext*, const KURL&); | 54 PresentationRequest(ExecutionContext*, const KURL&); |
| 53 | 55 |
| 54 KURL m_url; | 56 KURL m_url; |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace blink | 59 } // namespace blink |
| 58 | 60 |
| 59 #endif // PresentationRequest_h | 61 #endif // PresentationRequest_h |
| OLD | NEW |