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

Unified Diff: Source/modules/push_messaging/PushManager.cpp

Issue 841333002: Push API: rename registration to subscription. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use https in the spec link. Created 5 years, 11 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 | « Source/modules/push_messaging/PushManager.h ('k') | Source/modules/push_messaging/PushManager.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/push_messaging/PushManager.cpp
diff --git a/Source/modules/push_messaging/PushManager.cpp b/Source/modules/push_messaging/PushManager.cpp
index 15092724d8cbacd2f0d7e2f39fbdfc0f33c20184..3e6902638d903b06a7f227898ae1571625afe984 100644
--- a/Source/modules/push_messaging/PushManager.cpp
+++ b/Source/modules/push_messaging/PushManager.cpp
@@ -16,8 +16,8 @@
#include "modules/push_messaging/PushController.h"
#include "modules/push_messaging/PushError.h"
#include "modules/push_messaging/PushPermissionStatusCallbacks.h"
-#include "modules/push_messaging/PushRegistration.h"
-#include "modules/push_messaging/PushRegistrationCallbacks.h"
+#include "modules/push_messaging/PushSubscription.h"
+#include "modules/push_messaging/PushSubscriptionCallbacks.h"
#include "modules/serviceworkers/ServiceWorkerRegistration.h"
#include "public/platform/Platform.h"
#include "public/platform/WebPushClient.h"
@@ -42,10 +42,10 @@ PushManager::PushManager(ServiceWorkerRegistration* registration)
ASSERT(registration);
}
-ScriptPromise PushManager::registerPushMessaging(ScriptState* scriptState)
+ScriptPromise PushManager::subscribe(ScriptState* scriptState)
{
if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Registration failed - no active Service Worker"));
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Subscription failed - no active Service Worker"));
RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -58,23 +58,23 @@ ScriptPromise PushManager::registerPushMessaging(ScriptState* scriptState)
// FIXME: add test coverage for this condition - https://crbug.com/440431
if (!document->domWindow() || !document->frame())
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Document is detached from window."));
- PushController::clientFrom(document->frame()).registerPushMessaging(m_registration->webRegistration(), new PushRegistrationCallbacks(resolver, m_registration));
+ PushController::clientFrom(document->frame()).registerPushMessaging(m_registration->webRegistration(), new PushSubscriptionCallbacks(resolver, m_registration));
} else {
- pushProvider()->registerPushMessaging(m_registration->webRegistration(), new PushRegistrationCallbacks(resolver, m_registration));
+ pushProvider()->registerPushMessaging(m_registration->webRegistration(), new PushSubscriptionCallbacks(resolver, m_registration));
}
return promise;
}
-ScriptPromise PushManager::getRegistration(ScriptState* scriptState)
+ScriptPromise PushManager::getSubscription(ScriptState* scriptState)
{
if (!m_registration->active())
- return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Registration failed - no active Service Worker"));
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(AbortError, "Could not get subscription - no active Service Worker"));
RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
- pushProvider()->getRegistration(m_registration->webRegistration(), new PushRegistrationCallbacks(resolver, m_registration));
+ pushProvider()->getRegistration(m_registration->webRegistration(), new PushSubscriptionCallbacks(resolver, m_registration));
return promise;
}
« no previous file with comments | « Source/modules/push_messaging/PushManager.h ('k') | Source/modules/push_messaging/PushManager.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698