Index: third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp |
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp |
index a9d240483347be2444e6f5fc14f4f74db78d7311..702fb6385bb65d6793ac84ceda74af350f012140 100644 |
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp |
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp |
@@ -45,4 +45,33 @@ void PresentationConnectionCallbacks::onError( |
m_resolver->reject(PresentationError::take(error)); |
} |
+ExistingPresentationConnectionCallbacks:: |
+ ExistingPresentationConnectionCallbacks(ScriptPromiseResolver* resolver, |
+ PresentationConnection* connection) |
+ : m_resolver(resolver), m_connection(connection) { |
+ DCHECK(m_resolver); |
+ DCHECK(m_connection); |
+} |
+ |
+void ExistingPresentationConnectionCallbacks::onSuccess( |
+ std::unique_ptr<WebPresentationConnectionClient> |
+ PresentationConnectionClient) { |
+ if (!m_resolver->getExecutionContext() || |
+ m_resolver->getExecutionContext()->isContextDestroyed()) |
+ return; |
+ |
+ if (m_connection->getState() == WebPresentationConnectionState::Closed) |
+ m_connection->didChangeState(WebPresentationConnectionState::Connecting); |
+ |
+ m_resolver->resolve(m_connection); |
+} |
+ |
+void ExistingPresentationConnectionCallbacks::onError( |
mark a. foltz
2016/12/23 18:39:43
Looking at the spec, I don't think there's an erro
zhaobin
2016/12/30 05:05:00
Done.
|
+ const WebPresentationError& error) { |
+ if (!m_resolver->getExecutionContext() || |
+ m_resolver->getExecutionContext()->isContextDestroyed()) |
+ return; |
+ m_resolver->reject(PresentationError::take(error)); |
+} |
+ |
} // namespace blink |