Index: Source/modules/presentation/PresentationAvailabilityCallback.h |
diff --git a/Source/modules/presentation/PresentationAvailabilityCallback.h b/Source/modules/presentation/PresentationAvailabilityCallback.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3707c2caaaf2dd36319c6d542aa7131ea143864 |
--- /dev/null |
+++ b/Source/modules/presentation/PresentationAvailabilityCallback.h |
@@ -0,0 +1,37 @@ |
+// 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 PresentationAvailabilityCallback_h |
+#define PresentationAvailabilityCallback_h |
+ |
+#include "platform/heap/Handle.h" |
+#include "public/platform/WebCallbacks.h" |
+#include "wtf/Noncopyable.h" |
+ |
+namespace blink { |
+ |
+class ScriptPromiseResolver; |
+ |
+using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, void>; |
+ |
+// PresentationAvailabilityCallback is an implementation of |
+// WebPresentationAvailabilityCallbacks that will resolve the underlying promise |
+// depending on the result passed to the callback. |
+class PresentationAvailabilityCallback final |
+ : public WebPresentationAvailabilityCallbacks { |
+ WTF_MAKE_NONCOPYABLE(PresentationAvailabilityCallback); |
+public: |
+ explicit PresentationAvailabilityCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>); |
+ virtual ~PresentationAvailabilityCallback() = default; |
+ |
+ void onSuccess(bool*) override; |
+ void onError() override; |
+ |
+private: |
+ RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // PresentationAvailabilityCallback_h |