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

Unified Diff: Source/modules/presentation/PresentationSessionClientCallbacks.h

Issue 940503002: [PresentationAPI] Added plumbing for start/joinSession from JS to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comment Created 5 years, 10 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/presentation/PresentationSessionClientCallbacks.h
diff --git a/Source/modules/presentation/PresentationSessionClientCallbacks.h b/Source/modules/presentation/PresentationSessionClientCallbacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..75d94ebe9f8457d7a5ea4a57d40ad28ba4a8100d
--- /dev/null
+++ b/Source/modules/presentation/PresentationSessionClientCallbacks.h
@@ -0,0 +1,44 @@
+// 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 PresentationSessionClientCallbacks_h
+#define PresentationSessionClientCallbacks_h
+
+#include "platform/heap/Handle.h"
+#include "public/platform/modules/presentation/WebPresentationClient.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+class Presentation;
+class ScriptPromiseResolver;
+
+// The implementation of the WebCallbacks interface passed to the embedder to
+// get the result of start/joinSession() calls. Will in its turn resolve the
+// corresponding Promise given to the frame.
+// When creating the session succeeds, onSuccess() is invoked with the
+// implementation of the WebPresentationSessionClient interface. If creating the
+// session fails, onError() is invoked with the implementation of the
+// WebPresentationError interface.
+// Owned by the receiver of the callback and must be deleted after use.
+class PresentationSessionClientCallbacks final : public WebPresentationSessionClientCallbacks {
+ WTF_MAKE_NONCOPYABLE(PresentationSessionClientCallbacks);
+public:
+ PresentationSessionClientCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>, Presentation*);
+ virtual ~PresentationSessionClientCallbacks();
+
+ // WebPresentationSessionClientCallbacks implementation.
+ virtual void onSuccess(WebPresentationSessionClient*) override;
+ virtual void onError(WebPresentationError*) override;
+
+private:
+ RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver;
+ Persistent<Presentation> m_presentation;
+};
+
+} // namespace blink
+
+#endif // PresentationSessionClientCallbacks_h

Powered by Google App Engine
This is Rietveld 408576698