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

Side by Side Diff: content/child/push_messaging/push_provider.cc

Issue 2199213003: Use NotAllowedError instead of PermissionDeniedError for the Push API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix the browser tests Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/push_messaging/push_provider.h" 5 #include "content/child/push_messaging/push_provider.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 void PushProvider::OnSubscribeFromWorkerError(int request_id, 177 void PushProvider::OnSubscribeFromWorkerError(int request_id,
178 PushRegistrationStatus status) { 178 PushRegistrationStatus status) {
179 blink::WebPushSubscriptionCallbacks* callbacks = 179 blink::WebPushSubscriptionCallbacks* callbacks =
180 subscription_callbacks_.Lookup(request_id); 180 subscription_callbacks_.Lookup(request_id);
181 if (!callbacks) 181 if (!callbacks)
182 return; 182 return;
183 183
184 blink::WebPushError::ErrorType error_type = 184 blink::WebPushError::ErrorType error_type =
185 status == PUSH_REGISTRATION_STATUS_PERMISSION_DENIED 185 status == PUSH_REGISTRATION_STATUS_PERMISSION_DENIED
186 ? blink::WebPushError::ErrorTypePermissionDenied 186 ? blink::WebPushError::ErrorTypeNotAllowed
187 : blink::WebPushError::ErrorTypeAbort; 187 : blink::WebPushError::ErrorTypeAbort;
188 188
189 callbacks->onError(blink::WebPushError( 189 callbacks->onError(blink::WebPushError(
190 error_type, 190 error_type,
191 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); 191 blink::WebString::fromUTF8(PushRegistrationStatusToString(status))));
192 192
193 subscription_callbacks_.Remove(request_id); 193 subscription_callbacks_.Remove(request_id);
194 } 194 }
195 195
196 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) { 196 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 "supported."; 277 "supported.";
278 } 278 }
279 279
280 callbacks->onError( 280 callbacks->onError(
281 blink::WebPushError(error, blink::WebString::fromUTF8(error_message))); 281 blink::WebPushError(error, blink::WebString::fromUTF8(error_message)));
282 282
283 permission_status_callbacks_.Remove(request_id); 283 permission_status_callbacks_.Remove(request_id);
284 } 284 }
285 285
286 } // namespace content 286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698