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

Unified Diff: public/platform/modules/push_messaging/WebPushProvider.h

Issue 1304723002: [PushMessaging] Use appopriate type parameters for WebCallbacks (1/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« no previous file with comments | « public/platform/modules/push_messaging/WebPushClient.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/modules/push_messaging/WebPushProvider.h
diff --git a/public/platform/modules/push_messaging/WebPushProvider.h b/public/platform/modules/push_messaging/WebPushProvider.h
index cefc96117453fc9eb56aa5b04e67b7e44e7d9ad1..1e9494ef07b55fd5e5b170c60518d452427ea995 100644
--- a/public/platform/modules/push_messaging/WebPushProvider.h
+++ b/public/platform/modules/push_messaging/WebPushProvider.h
@@ -6,17 +6,44 @@
#define WebPushProvider_h
#include "public/platform/WebCallbacks.h"
+#include "public/platform/WebPassOwnPtr.h"
+#include "public/platform/modules/push_messaging/WebPushError.h"
#include "public/platform/modules/push_messaging/WebPushPermissionStatus.h"
+#include "public/platform/modules/push_messaging/WebPushSubscription.h"
namespace blink {
class WebServiceWorkerRegistration;
-struct WebPushError;
-struct WebPushSubscription;
struct WebPushSubscriptionOptions;
-using WebPushSubscriptionCallbacks = WebCallbacks<WebPushSubscription*, WebPushError*>;
-using WebPushPermissionStatusCallbacks = WebCallbacks<WebPushPermissionStatus*, WebPushError*>;
+class WebPushSubscriptionCallbacks : public WebCallbacks<WebPassOwnPtr<WebPushSubscription>, const WebPushError&> {
+public:
+ void onSuccess(WebPushSubscription* r)
+ {
+ onSuccess(adoptWebPtr(r));
+ }
+ void onError(WebPushError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onSuccess(WebPassOwnPtr<WebPushSubscription>) override {}
+ void onError(const WebPushError&) override {}
+};
+class WebPushPermissionStatusCallbacks : public WebCallbacks<WebPushPermissionStatus, const WebPushError&> {
+public:
+ void onSuccess(WebPushPermissionStatus* r)
+ {
+ onSuccess(*r);
+ }
+ void onError(WebPushError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onSuccess(WebPushPermissionStatus) override {}
+ void onError(const WebPushError&) override {}
+};
using WebPushUnsubscribeCallbacks = WebCallbacks<bool, const WebPushError&>;
class WebPushProvider {
« no previous file with comments | « public/platform/modules/push_messaging/WebPushClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698