Chromium Code Reviews| 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 |