Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1848)

Unified Diff: Source/modules/navigatorconnect/AcceptConnectionObserver.cpp

Issue 1205783004: Update navigator.services API to use the new services.onconnect event [3/3]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport-serviceside
Patch Set: remove extra space Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/navigatorconnect/AcceptConnectionObserver.cpp
diff --git a/Source/modules/navigatorconnect/AcceptConnectionObserver.cpp b/Source/modules/navigatorconnect/AcceptConnectionObserver.cpp
index e3b01a64c74c122365f21403d4ec8b63ac252c50..a1c2aa791ae7b731c3b8624ca716e931e98c197c 100644
--- a/Source/modules/navigatorconnect/AcceptConnectionObserver.cpp
+++ b/Source/modules/navigatorconnect/AcceptConnectionObserver.cpp
@@ -64,11 +64,6 @@ private:
ResolveType m_resolveType;
};
-AcceptConnectionObserver* AcceptConnectionObserver::create(ExecutionContext* context, int eventID)
-{
- return new AcceptConnectionObserver(context, eventID);
-}
-
AcceptConnectionObserver* AcceptConnectionObserver::create(ServicePortCollection* collection, PassOwnPtr<WebServicePortConnectEventCallbacks> callbacks, WebServicePortID portID, const KURL& targetURL)
{
return new AcceptConnectionObserver(collection, callbacks, portID, targetURL);
@@ -88,19 +83,6 @@ void AcceptConnectionObserver::didDispatchEvent()
responseWasRejected();
}
-void AcceptConnectionObserver::acceptConnection(ScriptState* scriptState, ScriptPromise value, ExceptionState& exceptionState)
-{
- if (m_state != Initial) {
- exceptionState.throwDOMException(InvalidStateError, "acceptConnection was already called.");
- return;
- }
-
- m_state = Pending;
- value.then(
- ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled),
- ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected));
-}
-
ScriptPromise AcceptConnectionObserver::respondWith(ScriptState* scriptState, ScriptPromise value, ExceptionState& exceptionState)
{
if (m_state != Initial) {
@@ -121,28 +103,13 @@ void AcceptConnectionObserver::responseWasRejected()
ASSERT(executionContext());
if (m_resolver)
m_resolver->reject(DOMException::create(AbortError));
- if (m_callbacks) {
- m_callbacks->onError();
- } else {
- ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleCrossOriginConnectEvent(m_eventID, false);
- }
+ m_callbacks->onError();
m_state = Done;
}
void AcceptConnectionObserver::responseWasResolved(const ScriptValue& value)
{
ASSERT(executionContext());
- if (!m_resolver) {
- // TODO(mek): Get rid of this block when observer is only used for
- // service port connect events.
- if (!value.v8Value()->IsTrue()) {
- responseWasRejected();
- return;
- }
- ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleCrossOriginConnectEvent(m_eventID, true);
- m_state = Done;
- return;
- }
ScriptState* scriptState = m_resolver->scriptState();
ExceptionState exceptionState(ExceptionState::UnknownContext, nullptr, nullptr, scriptState->context()->Global(), scriptState->isolate());
@@ -178,17 +145,8 @@ void AcceptConnectionObserver::responseWasResolved(const ScriptValue& value)
m_state = Done;
}
-AcceptConnectionObserver::AcceptConnectionObserver(ExecutionContext* context, int eventID)
- : ContextLifecycleObserver(context)
- , m_eventID(eventID)
- , m_portID(-1)
- , m_state(Initial)
-{
-}
-
AcceptConnectionObserver::AcceptConnectionObserver(ServicePortCollection* collection, PassOwnPtr<WebServicePortConnectEventCallbacks> callbacks, WebServicePortID portID, const KURL& targetURL)
: ContextLifecycleObserver(collection->executionContext())
- , m_eventID(-1)
, m_callbacks(callbacks)
, m_collection(collection)
, m_portID(portID)
« no previous file with comments | « Source/modules/navigatorconnect/AcceptConnectionObserver.h ('k') | Source/modules/navigatorconnect/CrossOriginConnectEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698