| 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 ServicePortConnectEvent_h | 5 #ifndef ServicePortConnectEvent_h |
| 6 #define ServicePortConnectEvent_h | 6 #define ServicePortConnectEvent_h |
| 7 | 7 |
| 8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "modules/serviceworkers/ExtendableEvent.h" | 10 #include "modules/serviceworkers/ExtendableEvent.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class AcceptConnectionObserver; | 15 class AcceptConnectionObserver; |
| 16 class ExceptionState; | 16 class ExceptionState; |
| 17 class ServicePortConnectEventInit; | 17 class ServicePortConnectEventInit; |
| 18 | 18 |
| 19 // A connect event is dispatched by the client to a service worker's script. | 19 // A connect event is dispatched by the client to a service worker's script. |
| 20 // AcceptConnectionObserver can be used to notify the client about the service | 20 // AcceptConnectionObserver can be used to notify the client about the service |
| 21 // worker's response. | 21 // worker's response. |
| 22 class MODULES_EXPORT ServicePortConnectEvent final : public ExtendableEvent { | 22 class MODULES_EXPORT ServicePortConnectEvent final : public ExtendableEvent { |
| 23 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| 24 public: | 24 public: |
| 25 static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create(); | 25 static RawPtr<ServicePortConnectEvent> create(); |
| 26 static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create(const AtomicSt
ring& type, const ServicePortConnectEventInit&); | 26 static RawPtr<ServicePortConnectEvent> create(const AtomicString& type, cons
t ServicePortConnectEventInit&); |
| 27 static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create(const AtomicSt
ring& type, const ServicePortConnectEventInit&, AcceptConnectionObserver*); | 27 static RawPtr<ServicePortConnectEvent> create(const AtomicString& type, cons
t ServicePortConnectEventInit&, AcceptConnectionObserver*); |
| 28 | 28 |
| 29 // ServicePortConnectEvent.idl | 29 // ServicePortConnectEvent.idl |
| 30 String targetURL() const { return m_targetURL; } | 30 String targetURL() const { return m_targetURL; } |
| 31 String origin() const { return m_origin; } | 31 String origin() const { return m_origin; } |
| 32 ScriptPromise respondWith(ScriptState*, const ScriptPromise& response, Excep
tionState&); | 32 ScriptPromise respondWith(ScriptState*, const ScriptPromise& response, Excep
tionState&); |
| 33 | 33 |
| 34 const AtomicString& interfaceName() const override; | 34 const AtomicString& interfaceName() const override; |
| 35 | 35 |
| 36 DECLARE_VIRTUAL_TRACE(); | 36 DECLARE_VIRTUAL_TRACE(); |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 ServicePortConnectEvent(); | 39 ServicePortConnectEvent(); |
| 40 ServicePortConnectEvent(const AtomicString& type, const ServicePortConnectEv
entInit&, AcceptConnectionObserver*); | 40 ServicePortConnectEvent(const AtomicString& type, const ServicePortConnectEv
entInit&, AcceptConnectionObserver*); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 PersistentWillBeMember<AcceptConnectionObserver> m_observer; | 43 Member<AcceptConnectionObserver> m_observer; |
| 44 String m_targetURL; | 44 String m_targetURL; |
| 45 String m_origin; | 45 String m_origin; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace blink | 48 } // namespace blink |
| 49 | 49 |
| 50 #endif // ServicePortConnectEvent_h | 50 #endif // ServicePortConnectEvent_h |
| OLD | NEW |