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

Unified Diff: content/child/push_messaging/push_provider.cc

Issue 1129833003: Rename "register" -> "subscribe" in the Push Messaging code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@p-userVisible-tests
Patch Set: Created 5 years, 7 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
Index: content/child/push_messaging/push_provider.cc
diff --git a/content/child/push_messaging/push_provider.cc b/content/child/push_messaging/push_provider.cc
index 0d85dee2a393bc26903a7da4a700335e8f46f3f7..32fd626f65cfa2f4a12d2fc29810e3111bce34d3 100644
--- a/content/child/push_messaging/push_provider.cc
+++ b/content/child/push_messaging/push_provider.cc
@@ -75,7 +75,7 @@ void PushProvider::subscribe(
subscription_callbacks_.AddWithID(callbacks, request_id);
int64 service_worker_registration_id =
GetServiceWorkerRegistrationId(service_worker_registration);
- thread_safe_sender_->Send(new PushMessagingHostMsg_RegisterFromWorker(
+ thread_safe_sender_->Send(new PushMessagingHostMsg_SubscribeFromWorker(
request_id, service_worker_registration_id, options.userVisibleOnly));
}
@@ -90,7 +90,7 @@ void PushProvider::unsubscribe(
int64 service_worker_registration_id =
GetServiceWorkerRegistrationId(service_worker_registration);
- thread_safe_sender_->Send(new PushMessagingHostMsg_Unregister(
+ thread_safe_sender_->Send(new PushMessagingHostMsg_Unsubscribe(
request_id, service_worker_registration_id));
}
@@ -103,7 +103,7 @@ void PushProvider::getSubscription(
subscription_callbacks_.AddWithID(callbacks, request_id);
int64 service_worker_registration_id =
GetServiceWorkerRegistrationId(service_worker_registration);
- thread_safe_sender_->Send(new PushMessagingHostMsg_GetRegistration(
+ thread_safe_sender_->Send(new PushMessagingHostMsg_GetSubscription(
request_id, service_worker_registration_id));
}
@@ -124,18 +124,18 @@ void PushProvider::getPermissionStatus(
bool PushProvider::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PushProvider, message)
- IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterFromWorkerSuccess,
- OnRegisterFromWorkerSuccess);
- IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterFromWorkerError,
- OnRegisterFromWorkerError);
- IPC_MESSAGE_HANDLER(PushMessagingMsg_UnregisterSuccess,
- OnUnregisterSuccess);
- IPC_MESSAGE_HANDLER(PushMessagingMsg_UnregisterError,
- OnUnregisterError);
- IPC_MESSAGE_HANDLER(PushMessagingMsg_GetRegistrationSuccess,
- OnGetRegistrationSuccess);
- IPC_MESSAGE_HANDLER(PushMessagingMsg_GetRegistrationError,
- OnGetRegistrationError);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromWorkerSuccess,
+ OnSubscribeFromWorkerSuccess);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromWorkerError,
+ OnSubscribeFromWorkerError);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_UnsubscribeSuccess,
+ OnUnsubscribeSuccess);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_UnsubscribeError,
+ OnUnsubscribeError);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_GetSubscriptionSuccess,
+ OnGetSubscriptionSuccess);
+ IPC_MESSAGE_HANDLER(PushMessagingMsg_GetSubscriptionError,
+ OnGetSubscriptionError);
IPC_MESSAGE_HANDLER(PushMessagingMsg_GetPermissionStatusSuccess,
OnGetPermissionStatusSuccess);
IPC_MESSAGE_HANDLER(PushMessagingMsg_GetPermissionStatusError,
@@ -146,10 +146,10 @@ bool PushProvider::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void PushProvider::OnRegisterFromWorkerSuccess(
+void PushProvider::OnSubscribeFromWorkerSuccess(
int request_id,
const GURL& endpoint,
- const std::string& registration_id) {
+ const std::string& subscription_id) {
blink::WebPushSubscriptionCallbacks* callbacks =
subscription_callbacks_.Lookup(request_id);
if (!callbacks)
@@ -158,14 +158,14 @@ void PushProvider::OnRegisterFromWorkerSuccess(
scoped_ptr<blink::WebPushSubscription> subscription(
new blink::WebPushSubscription(
blink::WebString::fromUTF8(endpoint.spec()),
- blink::WebString::fromUTF8(registration_id)));
+ blink::WebString::fromUTF8(subscription_id)));
callbacks->onSuccess(subscription.release());
subscription_callbacks_.Remove(request_id);
}
-void PushProvider::OnRegisterFromWorkerError(int request_id,
- PushRegistrationStatus status) {
+void PushProvider::OnSubscribeFromWorkerError(int request_id,
+ PushSubscriptionStatus status) {
blink::WebPushSubscriptionCallbacks* callbacks =
subscription_callbacks_.Lookup(request_id);
if (!callbacks)
@@ -173,24 +173,24 @@ void PushProvider::OnRegisterFromWorkerError(int request_id,
scoped_ptr<blink::WebPushError> error(new blink::WebPushError(
blink::WebPushError::ErrorTypeAbort,
- blink::WebString::fromUTF8(PushRegistrationStatusToString(status))));
+ blink::WebString::fromUTF8(PushSubscriptionStatusToString(status))));
callbacks->onError(error.release());
subscription_callbacks_.Remove(request_id);
}
-void PushProvider::OnUnregisterSuccess(int request_id, bool did_unregister) {
+void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) {
blink::WebPushUnsubscribeCallbacks* callbacks =
unsubscribe_callbacks_.Lookup(request_id);
if (!callbacks)
return;
- callbacks->onSuccess(&did_unregister);
+ callbacks->onSuccess(&did_unsubscribe);
unsubscribe_callbacks_.Remove(request_id);
}
-void PushProvider::OnUnregisterError(
+void PushProvider::OnUnsubscribeError(
int request_id,
blink::WebPushError::ErrorType error_type,
const std::string& error_message) {
@@ -206,10 +206,10 @@ void PushProvider::OnUnregisterError(
unsubscribe_callbacks_.Remove(request_id);
}
-void PushProvider::OnGetRegistrationSuccess(
+void PushProvider::OnGetSubscriptionSuccess(
int request_id,
const GURL& endpoint,
- const std::string& registration_id) {
+ const std::string& subscription_id) {
blink::WebPushSubscriptionCallbacks* callbacks =
subscription_callbacks_.Lookup(request_id);
if (!callbacks)
@@ -218,21 +218,21 @@ void PushProvider::OnGetRegistrationSuccess(
scoped_ptr<blink::WebPushSubscription> subscription(
new blink::WebPushSubscription(
blink::WebString::fromUTF8(endpoint.spec()),
- blink::WebString::fromUTF8(registration_id)));
+ blink::WebString::fromUTF8(subscription_id)));
callbacks->onSuccess(subscription.release());
subscription_callbacks_.Remove(request_id);
}
-void PushProvider::OnGetRegistrationError(
+void PushProvider::OnGetSubscriptionError(
int request_id,
- PushGetRegistrationStatus status) {
+ PushGetSubscriptionStatus status) {
blink::WebPushSubscriptionCallbacks* callbacks =
subscription_callbacks_.Lookup(request_id);
if (!callbacks)
return;
- // We are only expecting an error if we can't find a registration.
+ // We are only expecting an error if we can't find a subscription.
callbacks->onSuccess(nullptr);
subscription_callbacks_.Remove(request_id);

Powered by Google App Engine
This is Rietveld 408576698