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

Unified Diff: content/browser/push_messaging/push_messaging_manager.cc

Issue 2715903002: Re-design Unsubscribe and getPermissionStatus mojo interfaces. (Closed)
Patch Set: Re-design Unsubscribe and getPermissionStatus mojo interfaces. Created 3 years, 10 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 | « no previous file | content/child/push_messaging/push_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/push_messaging/push_messaging_manager.cc
diff --git a/content/browser/push_messaging/push_messaging_manager.cc b/content/browser/push_messaging/push_messaging_manager.cc
index c3ee50ec8beda20e19320f2ac713876d06cc8ed6..b2d354464870f29ebd7a291f537b59d765f1926b 100644
--- a/content/browser/push_messaging/push_messaging_manager.cc
+++ b/content/browser/push_messaging/push_messaging_manager.cc
@@ -643,21 +643,21 @@ void PushMessagingManager::DidUnregister(
case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED:
case PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR:
case PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR:
- callback.Run(true /* success */, true /* did_unsubscribe */,
- blink::WebPushError::ErrorTypeUnknown,
+ callback.Run(blink::WebPushError::ErrorTypeNone,
+ true /* did_unsubscribe */,
base::nullopt /* error_message */);
break;
case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED:
- callback.Run(true /* success */, false /* did_unsubscribe */,
- blink::WebPushError::ErrorTypeUnknown,
+ callback.Run(blink::WebPushError::ErrorTypeNone,
+ false /* did_unsubscribe */,
base::nullopt /* error_message */);
break;
case PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER:
case PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE:
case PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR:
- callback.Run(
- false /* error */, false, blink::WebPushError::ErrorTypeAbort,
- std::string(PushUnregistrationStatusToString(unregistration_status)));
+ callback.Run(blink::WebPushError::ErrorTypeAbort, false,
+ std::string(PushUnregistrationStatusToString(
+ unregistration_status)) /* error_message */);
break;
case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR:
NOTREACHED();
@@ -811,8 +811,9 @@ void PushMessagingManager::GetPermissionStatus(
service_worker_context_->GetLiveRegistration(
service_worker_registration_id);
if (!service_worker_registration) {
- callback.Run(false /* error */, blink::WebPushPermissionStatusDenied,
- blink::WebPushError::ErrorTypeAbort);
+ // Return error: ErrorTypeAbort.
+ callback.Run(blink::WebPushError::ErrorTypeAbort,
+ blink::WebPushPermissionStatusDenied);
return;
}
@@ -835,9 +836,9 @@ void PushMessagingManager::Core::GetPermissionStatusOnUI(
if (!user_visible && !push_service->SupportNonVisibleMessages()) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(callback, false /* error */,
- blink::WebPushPermissionStatusDenied,
- blink::WebPushError::ErrorTypeNotSupported));
+ // Return error: ErrorTypeNotSupported.
+ base::Bind(callback, blink::WebPushError::ErrorTypeNotSupported,
+ blink::WebPushPermissionStatusDenied));
return;
}
permission_status =
@@ -846,16 +847,17 @@ void PushMessagingManager::Core::GetPermissionStatusOnUI(
// Return prompt, so the website can't detect incognito mode.
permission_status = blink::WebPushPermissionStatusPrompt;
} else {
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(callback, false /* error */,
- blink::WebPushPermissionStatusDenied,
- blink::WebPushError::ErrorTypeAbort));
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ // Return error: ErrorTypeAbort.
+ base::Bind(callback, blink::WebPushError::ErrorTypeAbort,
+ blink::WebPushPermissionStatusDenied));
return;
}
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(callback, true /* success */, permission_status,
- blink::WebPushError::ErrorTypeUnknown));
+ base::Bind(callback, blink::WebPushError::ErrorTypeNone,
+ permission_status));
}
// Helper methods on both IO and UI threads, merged from
« no previous file with comments | « no previous file | content/child/push_messaging/push_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698