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

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp

Issue 2602523002: [Presentation API] Resolve PresentationRequest::reconnect() with existing presentation connection i… (Closed)
Patch Set: Created 4 years 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: 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

Powered by Google App Engine
This is Rietveld 408576698