| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/presentation/PresentationRequest.h" | 6 #include "modules/presentation/PresentationRequest.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| 11 #include "bindings/core/v8/ScriptPromiseResolver.h" | 11 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 12 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
| 13 #include "core/dom/ExecutionContext.h" | 13 #include "core/dom/ExecutionContext.h" |
| 14 #include "core/frame/UseCounter.h" |
| 14 #include "modules/EventTargetModules.h" | 15 #include "modules/EventTargetModules.h" |
| 15 #include "modules/presentation/PresentationAvailability.h" | 16 #include "modules/presentation/PresentationAvailability.h" |
| 16 #include "modules/presentation/PresentationAvailabilityCallbacks.h" | 17 #include "modules/presentation/PresentationAvailabilityCallbacks.h" |
| 17 #include "modules/presentation/PresentationController.h" | 18 #include "modules/presentation/PresentationController.h" |
| 18 #include "modules/presentation/PresentationError.h" | 19 #include "modules/presentation/PresentationError.h" |
| 19 #include "modules/presentation/PresentationSession.h" | 20 #include "modules/presentation/PresentationSession.h" |
| 20 #include "modules/presentation/PresentationSessionCallbacks.h" | 21 #include "modules/presentation/PresentationSessionCallbacks.h" |
| 21 | 22 |
| 22 namespace blink { | 23 namespace blink { |
| 23 | 24 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 const AtomicString& PresentationRequest::interfaceName() const | 55 const AtomicString& PresentationRequest::interfaceName() const |
| 55 { | 56 { |
| 56 return EventTargetNames::PresentationRequest; | 57 return EventTargetNames::PresentationRequest; |
| 57 } | 58 } |
| 58 | 59 |
| 59 ExecutionContext* PresentationRequest::executionContext() const | 60 ExecutionContext* PresentationRequest::executionContext() const |
| 60 { | 61 { |
| 61 return ActiveDOMObject::executionContext(); | 62 return ActiveDOMObject::executionContext(); |
| 62 } | 63 } |
| 63 | 64 |
| 65 bool PresentationRequest::addEventListener(const AtomicString& eventType, PassRe
fPtrWillBeRawPtr<EventListener> listener, bool capture) |
| 66 { |
| 67 if (eventType == EventTypeNames::sessionconnect) |
| 68 UseCounter::count(executionContext(), UseCounter::PresentationRequestSes
sionConnectEventListener); |
| 69 |
| 70 return EventTarget::addEventListener(eventType, listener, capture); |
| 71 } |
| 72 |
| 64 bool PresentationRequest::hasPendingActivity() const | 73 bool PresentationRequest::hasPendingActivity() const |
| 65 { | 74 { |
| 66 // Prevents garbage collecting of this object when not hold by another | 75 // Prevents garbage collecting of this object when not hold by another |
| 67 // object but still has listeners registered. | 76 // object but still has listeners registered. |
| 68 return hasEventListeners(); | 77 return hasEventListeners(); |
| 69 } | 78 } |
| 70 | 79 |
| 71 ScriptPromise PresentationRequest::start(ScriptState* scriptState) | 80 ScriptPromise PresentationRequest::start(ScriptState* scriptState) |
| 72 { | 81 { |
| 73 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 82 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ActiveDOMObject::trace(visitor); | 132 ActiveDOMObject::trace(visitor); |
| 124 } | 133 } |
| 125 | 134 |
| 126 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, con
st KURL& url) | 135 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, con
st KURL& url) |
| 127 : ActiveDOMObject(executionContext) | 136 : ActiveDOMObject(executionContext) |
| 128 , m_url(url) | 137 , m_url(url) |
| 129 { | 138 { |
| 130 } | 139 } |
| 131 | 140 |
| 132 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |