| 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/PresentationController.h" | 17 #include "modules/presentation/PresentationController.h" |
| 17 #include "modules/presentation/PresentationError.h" | 18 #include "modules/presentation/PresentationError.h" |
| 18 #include "modules/presentation/PresentationSession.h" | 19 #include "modules/presentation/PresentationSession.h" |
| 19 #include "modules/presentation/PresentationSessionCallbacks.h" | 20 #include "modules/presentation/PresentationSessionCallbacks.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 53 const AtomicString& PresentationRequest::interfaceName() const | 54 const AtomicString& PresentationRequest::interfaceName() const |
| 54 { | 55 { |
| 55 return EventTargetNames::PresentationRequest; | 56 return EventTargetNames::PresentationRequest; |
| 56 } | 57 } |
| 57 | 58 |
| 58 ExecutionContext* PresentationRequest::executionContext() const | 59 ExecutionContext* PresentationRequest::executionContext() const |
| 59 { | 60 { |
| 60 return ActiveDOMObject::executionContext(); | 61 return ActiveDOMObject::executionContext(); |
| 61 } | 62 } |
| 62 | 63 |
| 64 bool PresentationRequest::addEventListener(const AtomicString& eventType, PassRe
fPtrWillBeRawPtr<EventListener> listener, bool capture) |
| 65 { |
| 66 if (eventType == EventTypeNames::sessionconnect) |
| 67 UseCounter::count(executionContext(), UseCounter::PresentationRequestSes
sionConnectEventListener); |
| 68 |
| 69 return EventTarget::addEventListener(eventType, listener, capture); |
| 70 } |
| 71 |
| 63 bool PresentationRequest::hasPendingActivity() const | 72 bool PresentationRequest::hasPendingActivity() const |
| 64 { | 73 { |
| 65 // Prevents garbage collecting of this object when not hold by another | 74 // Prevents garbage collecting of this object when not hold by another |
| 66 // object but still has listeners registered. | 75 // object but still has listeners registered. |
| 67 return hasEventListeners(); | 76 return hasEventListeners(); |
| 68 } | 77 } |
| 69 | 78 |
| 70 ScriptPromise PresentationRequest::start(ScriptState* scriptState) | 79 ScriptPromise PresentationRequest::start(ScriptState* scriptState) |
| 71 { | 80 { |
| 72 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 81 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| (...skipping 50 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 |