| Index: Source/modules/push_messaging/PushRegistrationCallbacks.h
|
| diff --git a/Source/modules/push_messaging/PushRegistrationCallbacks.h b/Source/modules/push_messaging/PushRegistrationCallbacks.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cdf4c90adbda1dd5c63bd080bda992acf4d1d8c2
|
| --- /dev/null
|
| +++ b/Source/modules/push_messaging/PushRegistrationCallbacks.h
|
| @@ -0,0 +1,41 @@
|
| +// 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 PushRegistrationCallbacks_h
|
| +#define PushRegistrationCallbacks_h
|
| +
|
| +#include "platform/heap/Handle.h"
|
| +#include "public/platform/WebCallbacks.h"
|
| +#include "wtf/Noncopyable.h"
|
| +#include "wtf/PassRefPtr.h"
|
| +#include "wtf/RefPtr.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class ServiceWorkerRegistration;
|
| +class ScriptPromiseResolver;
|
| +struct WebPushError;
|
| +struct WebPushRegistration;
|
| +
|
| +// PushRegistrationCallbacks is an implementation of WebPushRegistrationCallbacks
|
| +// that will resolve the underlying promise depending on the result passed to
|
| +// the callback. It takes a ServiceWorkerRegistration in its constructor and
|
| +// will pass it to the PushRegistration.
|
| +class PushRegistrationCallbacks final : public WebCallbacks<WebPushRegistration, WebPushError> {
|
| + WTF_MAKE_NONCOPYABLE(PushRegistrationCallbacks);
|
| +public:
|
| + PushRegistrationCallbacks(PassRefPtr<ScriptPromiseResolver>, ServiceWorkerRegistration*);
|
| + ~PushRegistrationCallbacks() override;
|
| +
|
| + void onSuccess(WebPushRegistration*) override;
|
| + void onError(WebPushError*) override;
|
| +
|
| +private:
|
| + RefPtr<ScriptPromiseResolver> m_resolver;
|
| + Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // PushRegistrationCallbacks_h
|
|
|