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

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

Issue 1133083002: Reject the permissionState promise with NotSupported Exception (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 23033b5820d76617cf177a8f7dc8739fff6cc2d8..14c657ac283cfbf376db8ab10516a1fe21f801a5 100644
--- a/content/child/push_messaging/push_provider.cc
+++ b/content/child/push_messaging/push_provider.cc
@@ -279,13 +279,27 @@ void PushProvider::OnGetPermissionStatusSuccess(
permission_status_callbacks_.Remove(request_id);
}
-void PushProvider::OnGetPermissionStatusError(int request_id) {
+void PushProvider::OnGetPermissionStatusError(
+ int request_id,
+ blink::WebPushError::ErrorType error) {
blink::WebPushPermissionStatusCallbacks* callbacks =
permission_status_callbacks_.Lookup(request_id);
if (!callbacks)
return;
- callbacks->onError();
+ std::string error_message;
+ if (error == blink::WebPushError::ErrorTypeNotSupported) {
+ error_message =
+ "push subscriptions that don't enable userVisibleOnly are not "
+ "supported.";
Peter Beverloo 2015/05/11 12:56:07 Capitalization - it's a sentence.
Miguel Garcia 2015/05/11 13:50:38 Done.
+ } else {
+ error_message = "";
Peter Beverloo 2015/05/11 12:56:07 No need to set it to an empty string - the constru
Miguel Garcia 2015/05/11 13:50:38 Done.
+ }
+
+ scoped_ptr<blink::WebPushError> web_error(new blink::WebPushError(
+ error, blink::WebString::fromUTF8(error_message)));
+
+ callbacks->onError(web_error.release());
permission_status_callbacks_.Remove(request_id);
}

Powered by Google App Engine
This is Rietveld 408576698