| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 AcceptConnectionObserver_h | 5 #ifndef AcceptConnectionObserver_h |
| 6 #define AcceptConnectionObserver_h | 6 #define AcceptConnectionObserver_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/navigatorconnect/ServicePortCollection.h" | 11 #include "modules/navigatorconnect/ServicePortCollection.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "public/platform/modules/navigator_services/WebServicePort.h" | 13 #include "public/platform/modules/navigator_services/WebServicePort.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class ExceptionState; | 17 class ExceptionState; |
| 18 class ExecutionContext; | 18 class ExecutionContext; |
| 19 class ScriptPromise; | 19 class ScriptPromise; |
| 20 class ScriptState; | 20 class ScriptState; |
| 21 class ScriptValue; | 21 class ScriptValue; |
| 22 | 22 |
| 23 // This class observes the service worker's handling of a ServicePortConnectEven
t | 23 // This class observes the service worker's handling of a ServicePortConnectEven
t |
| 24 // and notifies the client of the result. Created for each instance of | 24 // and notifies the client of the result. Created for each instance of |
| 25 // ServicePortConnectEvent. | 25 // ServicePortConnectEvent. |
| 26 class MODULES_EXPORT AcceptConnectionObserver final : public GarbageCollectedFin
alized<AcceptConnectionObserver>, public ContextLifecycleObserver { | 26 class MODULES_EXPORT AcceptConnectionObserver final : public GarbageCollectedFin
alized<AcceptConnectionObserver>, public ContextLifecycleObserver { |
| 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(AcceptConnectionObserver); | 27 USING_GARBAGE_COLLECTED_MIXIN(AcceptConnectionObserver); |
| 28 public: | 28 public: |
| 29 static AcceptConnectionObserver* create(ServicePortCollection*, PassOwnPtr<W
ebServicePortConnectEventCallbacks>, WebServicePortID, const KURL& targetURL); | 29 static AcceptConnectionObserver* create(ServicePortCollection*, PassOwnPtr<W
ebServicePortConnectEventCallbacks>, WebServicePortID, const KURL& targetURL); |
| 30 | 30 |
| 31 void contextDestroyed() override; | 31 void contextDestroyed() override; |
| 32 | 32 |
| 33 // Must be called after dispatching the event. Will cause the connection to | 33 // Must be called after dispatching the event. Will cause the connection to |
| 34 // be rejected if no call to acceptConnection or respondWith was made. | 34 // be rejected if no call to acceptConnection or respondWith was made. |
| 35 void didDispatchEvent(); | 35 void didDispatchEvent(); |
| 36 | 36 |
| 37 // Observes the promise and delays calling didHandleServicePortConnectEvent(
) | 37 // Observes the promise and delays calling didHandleServicePortConnectEvent(
) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 55 KURL m_targetURL; | 55 KURL m_targetURL; |
| 56 Member<ScriptPromiseResolver> m_resolver; | 56 Member<ScriptPromiseResolver> m_resolver; |
| 57 | 57 |
| 58 enum State { Initial, Pending, Done }; | 58 enum State { Initial, Pending, Done }; |
| 59 State m_state; | 59 State m_state; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| 63 | 63 |
| 64 #endif // AcceptConnectionObserver_h | 64 #endif // AcceptConnectionObserver_h |
| OLD | NEW |