OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/navigatorconnect/ServicePortConnectEvent.h" |
| 7 |
| 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "modules/navigatorconnect/AcceptConnectionObserver.h" |
| 11 #include "modules/navigatorconnect/ServicePortConnectEventInit.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create(
) |
| 16 { |
| 17 return adoptRefWillBeNoop(new ServicePortConnectEvent()); |
| 18 } |
| 19 |
| 20 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create(
const AtomicString& type, const ServicePortConnectEventInit& initializer) |
| 21 { |
| 22 return adoptRefWillBeNoop(new ServicePortConnectEvent(type, initializer, nul
lptr)); |
| 23 } |
| 24 |
| 25 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create(
const AtomicString& type, const ServicePortConnectEventInit& initializer, Accept
ConnectionObserver* observer) |
| 26 { |
| 27 return adoptRefWillBeNoop(new ServicePortConnectEvent(type, initializer, obs
erver)); |
| 28 } |
| 29 |
| 30 ScriptPromise ServicePortConnectEvent::respondWith(ScriptState* scriptState, con
st ScriptPromise& response, ExceptionState& exceptionState) |
| 31 { |
| 32 stopImmediatePropagation(); |
| 33 if (m_observer) |
| 34 return m_observer->respondWith(scriptState, response, exceptionState); |
| 35 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea
te(NotSupportedError)); |
| 36 } |
| 37 |
| 38 const AtomicString& ServicePortConnectEvent::interfaceName() const |
| 39 { |
| 40 return EventNames::ServicePortConnectEvent; |
| 41 } |
| 42 |
| 43 DEFINE_TRACE(ServicePortConnectEvent) |
| 44 { |
| 45 visitor->trace(m_observer); |
| 46 ExtendableEvent::trace(visitor); |
| 47 } |
| 48 |
| 49 ServicePortConnectEvent::ServicePortConnectEvent() |
| 50 { |
| 51 } |
| 52 |
| 53 ServicePortConnectEvent::ServicePortConnectEvent(const AtomicString& type, const
ServicePortConnectEventInit& initializer, AcceptConnectionObserver* observer) |
| 54 : ExtendableEvent(type, initializer) |
| 55 , m_observer(observer) |
| 56 , m_targetURL(initializer.targetURL()) |
| 57 , m_origin(initializer.origin()) |
| 58 { |
| 59 } |
| 60 |
| 61 } // namespace blink |
| 62 |
OLD | NEW |