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

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

Issue 1222623003: Presentation API: implement .getAvalability() (Blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix tests Created 5 years, 5 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/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

Powered by Google App Engine
This is Rietveld 408576698