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

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: resolve code review comments from haraken, Mark, and mlamouri 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..04429045cab72bd08b7b1536b46128b0d1ad2117 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
@@ -45,4 +45,30 @@ 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;
mlamouri (slow - plz ping) 2017/01/03 12:02:11 style: add { } because of 2-line condition. You ca
zhaobin 2017/01/03 20:12:07 Done.
+
+ if (m_connection->getState() == WebPresentationConnectionState::Closed)
+ m_connection->didChangeState(WebPresentationConnectionState::Connecting);
+
+ m_resolver->resolve(m_connection);
+}
+
+void ExistingPresentationConnectionCallbacks::onError(
+ const WebPresentationError& error) {
+ NOTREACHED();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698