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

Unified Diff: third_party/WebKit/Source/modules/presentation/ExistingPresentationConnectionCallbacks.h

Issue 2602523002: [Presentation API] Resolve PresentationRequest::reconnect() with existing presentation connection i… (Closed)
Patch Set: remove getExecutionContext() null check in PresentationRequest::reconnect() Created 3 years, 11 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: third_party/WebKit/Source/modules/presentation/ExistingPresentationConnectionCallbacks.h
diff --git a/third_party/WebKit/Source/modules/presentation/ExistingPresentationConnectionCallbacks.h b/third_party/WebKit/Source/modules/presentation/ExistingPresentationConnectionCallbacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..055de84f30d1756611ca0f9fcfacabec71d892d8
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/ExistingPresentationConnectionCallbacks.h
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ExistingPresentationConnectionCallbacks_h
+#define ExistingPresentationConnectionCallbacks_h
+
+#include "platform/heap/Handle.h"
+#include "public/platform/WebCallbacks.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class PresentationConnection;
+class ScriptPromiseResolver;
+struct WebPresentationError;
+struct WebPresentationSessionInfo;
+
+// ExistingPresentationConnectionCallbacks extends WebCallbacks to resolve the
+// underlying promise. It takes the PresentationConnection object that
+// originated the call in its constructor and will resolve underlying promise
+// with that object.
+class ExistingPresentationConnectionCallbacks final
+ : public WebCallbacks<const WebPresentationSessionInfo&,
+ const WebPresentationError&> {
+ public:
+ ExistingPresentationConnectionCallbacks(ScriptPromiseResolver*,
+ PresentationConnection*);
+ ~ExistingPresentationConnectionCallbacks() override = default;
+
+ void onSuccess(const WebPresentationSessionInfo&) override;
+ void onError(const WebPresentationError&) override;
+
+ private:
+ Persistent<ScriptPromiseResolver> m_resolver;
+ Persistent<PresentationConnection> m_connection;
+
+ WTF_MAKE_NONCOPYABLE(ExistingPresentationConnectionCallbacks);
+};
+
+} // namespace blink
+
+#endif // ExistingPresentationConnectionCallbacks_h

Powered by Google App Engine
This is Rietveld 408576698