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

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

Issue 793913002: Stub implementation for PushRegistration.unregister(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@mvan_6
Patch Set: rebase Created 6 years 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/PushRegistrationCallback.h
diff --git a/Source/modules/push_messaging/PushRegistrationCallback.h b/Source/modules/push_messaging/PushRegistrationCallback.h
new file mode 100644
index 0000000000000000000000000000000000000000..fed5be209b7cc888e154fb4de1c609153680bc76
--- /dev/null
+++ b/Source/modules/push_messaging/PushRegistrationCallback.h
@@ -0,0 +1,45 @@
+// 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 PushRegistrationCallback_h
+#define PushRegistrationCallback_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;
+
+// PushRegistrationCallback 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 PushRegistrationCallback final
Michael van Ouwerkerk 2014/12/12 12:18:04 Please rename to PushRegistrationCallbacks. It's a
mlamouri (slow - plz ping) 2014/12/15 10:55:07 Sic :(
+ : public WebCallbacks<WebPushRegistration, WebPushError> {
Michael van Ouwerkerk 2014/12/12 12:18:04 Just write WebPushRegistrationCallbacks
jochen (gone - plz use gerrit) 2014/12/12 14:26:12 should be on previous line (no line length limit)
mlamouri (slow - plz ping) 2014/12/15 10:55:07 Hmm, I don't think so. It would require including
+public:
+ explicit PushRegistrationCallback(PassRefPtr<ScriptPromiseResolver>, ServiceWorkerRegistration*);
Michael van Ouwerkerk 2014/12/12 12:18:04 omit explicit as there are two arguments
mlamouri (slow - plz ping) 2014/12/15 10:55:07 Done.
+ virtual ~PushRegistrationCallback();
Michael van Ouwerkerk 2014/12/12 12:18:04 Hmmz, I guess we should mark these with override i
mlamouri (slow - plz ping) 2014/12/15 10:55:07 Done.
+
+ void onSuccess(WebPushRegistration*) override;
+ void onError(WebPushError*) override;
+
+ void trace(Visitor*);
+
+private:
+ RefPtr<ScriptPromiseResolver> m_resolver;
+ Persistent<ServiceWorkerRegistration> m_registration;
Michael van Ouwerkerk 2014/12/12 12:18:04 Please rename to m_serviceWorkerRegistration to di
mlamouri (slow - plz ping) 2014/12/15 10:55:07 Done.
+
+ WTF_MAKE_NONCOPYABLE(PushRegistrationCallback);
+};
+
+} // namespace blink
+
+#endif // PushRegistrationCallback_h

Powered by Google App Engine
This is Rietveld 408576698