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 |