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; |
} |