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

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: Rebase Layout test 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..6daf69ea830f27d34923b96edfe26581e9500293
--- /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/WebPushClient.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();
+
+ void onSuccess(WebPushPermissionStatus*) override;
+
+ // Called if for some reason the status of the push permission cannot be checked.
+ void onError() override;
+
+private:
+ static const WTF::String& permissionString(WebPushPermissionStatus);
+ RefPtr<ScriptPromiseResolver> m_resolver;
+};
+
+} // namespace blink
+
+#endif // PushPermissionCallback_h
« no previous file with comments | « Source/modules/push_messaging/PushManager.idl ('k') | Source/modules/push_messaging/PushPermissionCallback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698