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

Unified Diff: Source/modules/push_messaging/PushPermissionCallback.h

Issue 658723003: Blink implementation of PushManager#hasPermission() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Upgrade the push-messaging-api-surface-actual layout test to include hasPermission Created 6 years, 2 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/push_messaging/PushPermissionCallback.h
diff --git a/Source/modules/push_messaging/PushPermissionCallback.h b/Source/modules/push_messaging/PushPermissionCallback.h
new file mode 100644
index 0000000000000000000000000000000000000000..9cb8846ada974123225417b1a1ecaa946057aef5
--- /dev/null
+++ b/Source/modules/push_messaging/PushPermissionCallback.h
@@ -0,0 +1,42 @@
+// Copyright 2014 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 PushPermissionCallback_h
+#define PushPermissionCallback_h
+
+#include "public/platform/WebPushPermissionCallback.h"
+#include "public/platform/WebPushPermissionStatus.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WTF {
+class String;
+}
+
+namespace blink {
+
+class ScriptPromiseResolver;
+
+// Will resolve the underlying promise depending on the permission passed to the callback.
+class PushPermissionCallback final : public WebPushPermissionCallback {
+ WTF_MAKE_NONCOPYABLE(PushPermissionCallback);
+
+public:
+ explicit PushPermissionCallback(PassRefPtr<ScriptPromiseResolver>);
+ virtual ~PushPermissionCallback();
+
+ virtual void onSuccess(WebPushPermissionStatus) override;
Michael van Ouwerkerk 2014/10/24 10:36:37 Nit: omit virtual
Miguel Garcia 2014/10/28 11:07:00 Done.
+
+ // Called if for some reason the status of the push permission cannot be checked.
+ virtual void onError() override;
Michael van Ouwerkerk 2014/10/24 10:36:37 Nit: omit virtual
Miguel Garcia 2014/10/28 11:07:00 Done.
+
+private:
+ static const WTF::String& permissionString(WebPushPermissionStatus);
+ RefPtr<ScriptPromiseResolver> m_resolver;
+};
+
+} // namespace blink
+
+#endif // PushPermissionCallback_h

Powered by Google App Engine
This is Rietveld 408576698