diff options
author | johnme <johnme@chromium.org> | 2015-02-16 07:08:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-16 15:09:22 +0000 |
commit | ceafd1f9e5270d3727c9707b53b0b2933aa19a27 (patch) | |
tree | 743192e08a057a0043263d60a1b893e79d982bc1 /content | |
parent | 13a61c4c595371a3bb6286110e3c3f920818cbc2 (diff) | |
download | chromium_src-ceafd1f9e5270d3727c9707b53b0b2933aa19a27.zip chromium_src-ceafd1f9e5270d3727c9707b53b0b2933aa19a27.tar.gz chromium_src-ceafd1f9e5270d3727c9707b53b0b2933aa19a27.tar.bz2 |
Push API: Generate random GUIDs for GCM app_id privacy
BUG=458592
Review URL: https://codereview.chromium.org/927533003
Cr-Commit-Position: refs/heads/master@{#316481}
Diffstat (limited to 'content')
5 files changed, 46 insertions, 22 deletions
diff --git a/content/browser/push_messaging/push_messaging_message_filter.cc b/content/browser/push_messaging/push_messaging_message_filter.cc index ab3b96a..8e151d7 100644 --- a/content/browser/push_messaging/push_messaging_message_filter.cc +++ b/content/browser/push_messaging/push_messaging_message_filter.cc @@ -430,7 +430,9 @@ void PushMessagingMessageFilter::UnregisterFromService( return; } - service()->Unregister(requesting_origin, service_worker_registration_id, + service()->Unregister( + requesting_origin, service_worker_registration_id, + false /* retry_on_failure */, base::Bind(&PushMessagingMessageFilter::DidUnregisterFromService, weak_factory_ui_to_ui_.GetWeakPtr(), request_id, @@ -443,9 +445,17 @@ void PushMessagingMessageFilter::DidUnregisterFromService( PushUnregistrationStatus unregistration_status) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (unregistration_status != PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER) { - DidUnregister(request_id, unregistration_status); - return; + switch (unregistration_status) { + case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER: + break; + case PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR: + NOTREACHED(); + break; + case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED: + case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR: + case PUSH_UNREGISTRATION_STATUS_UNKNOWN_ERROR: + DidUnregister(request_id, unregistration_status); + return; } BrowserThread::PostTask( @@ -463,24 +473,25 @@ void PushMessagingMessageFilter::DidUnregister( int request_id, PushUnregistrationStatus unregistration_status) { switch (unregistration_status) { - case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER: - Send(new PushMessagingMsg_UnregisterSuccess(request_id, true)); - return; - case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED: - Send(new PushMessagingMsg_UnregisterSuccess(request_id, false)); - return; - case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR: - Send(new PushMessagingMsg_UnregisterError( - request_id, - blink::WebPushError::ErrorTypeNetwork, - "Failed to connect to the push server.")); - return; - case PUSH_UNREGISTRATION_STATUS_UNKNOWN_ERROR: - Send(new PushMessagingMsg_UnregisterError( - request_id, - blink::WebPushError::ErrorTypeUnknown, - "Unexpected error while trying to unregister from the push server.")); - return; + case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER: + case PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR: + Send(new PushMessagingMsg_UnregisterSuccess(request_id, true)); + return; + case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED: + Send(new PushMessagingMsg_UnregisterSuccess(request_id, false)); + return; + case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR: + Send(new PushMessagingMsg_UnregisterError( + request_id, + blink::WebPushError::ErrorTypeNetwork, + "Failed to connect to the push server.")); + return; + case PUSH_UNREGISTRATION_STATUS_UNKNOWN_ERROR: + Send(new PushMessagingMsg_UnregisterError( + request_id, + blink::WebPushError::ErrorTypeUnknown, + "Unexpected error while trying to unregister from the push server.")); + return; } } diff --git a/content/public/browser/push_messaging_service.h b/content/public/browser/push_messaging_service.h index 44daa7c..4d06cdd 100644 --- a/content/public/browser/push_messaging_service.h +++ b/content/public/browser/push_messaging_service.h @@ -77,6 +77,7 @@ class CONTENT_EXPORT PushMessagingService { // the push service. virtual void Unregister(const GURL& requesting_origin, int64 service_worker_registration_id, + bool retry_on_failure, const UnregisterCallback& callback) = 0; // Checks the permission status for the requesting origin. Permission is only diff --git a/content/public/common/push_messaging_status.h b/content/public/common/push_messaging_status.h index b59ead9..e91e944 100644 --- a/content/public/common/push_messaging_status.h +++ b/content/public/common/push_messaging_status.h @@ -56,6 +56,10 @@ enum PushUnregistrationStatus { // The unregistration was successful. PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER, + // The registration did not happen because of a network error, but will be + // retried until it succeeds. + PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR, + // The registration was not registered. PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED, @@ -92,6 +96,12 @@ enum PushDeliveryStatus { // The message could not be delivered because it was invalid. PUSH_DELIVERY_STATUS_INVALID_MESSAGE, + // The message could not be delivered because the app id was unknown. + PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID, + + // The message could not be delivered because origin no longer has permission. + PUSH_DELIVERY_STATUS_PERMISSION_DENIED, + // The message could not be delivered because no service worker was found. PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER, diff --git a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc index 9e31992..4082559 100644 --- a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc +++ b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc @@ -67,6 +67,7 @@ LayoutTestPushMessagingService::GetPermissionStatus( void LayoutTestPushMessagingService::Unregister( const GURL& requesting_origin, int64 service_worker_registration_id, + bool retry_on_failure, const UnregisterCallback& callback) { callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER); } diff --git a/content/shell/browser/layout_test/layout_test_push_messaging_service.h b/content/shell/browser/layout_test/layout_test_push_messaging_service.h index d0ed5f3..ad44b26 100644 --- a/content/shell/browser/layout_test/layout_test_push_messaging_service.h +++ b/content/shell/browser/layout_test/layout_test_push_messaging_service.h @@ -42,6 +42,7 @@ class LayoutTestPushMessagingService : public PushMessagingService { const GURL& embedding_origin) override; void Unregister(const GURL& requesting_origin, int64 service_worker_registration_id, + bool retry_on_failure, const UnregisterCallback& callback) override; private: |