Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 blink::WebPushPermissionStatusCallbacks* callbacks = | 244 blink::WebPushPermissionStatusCallbacks* callbacks = |
| 245 permission_status_callbacks_.Lookup(request_id); | 245 permission_status_callbacks_.Lookup(request_id); |
| 246 if (!callbacks) | 246 if (!callbacks) |
| 247 return; | 247 return; |
| 248 | 248 |
| 249 callbacks->onSuccess(&status); | 249 callbacks->onSuccess(&status); |
| 250 | 250 |
| 251 permission_status_callbacks_.Remove(request_id); | 251 permission_status_callbacks_.Remove(request_id); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void PushProvider::OnGetPermissionStatusError(int request_id) { | 254 void PushProvider::OnGetPermissionStatusError( |
| 255 int request_id, | |
| 256 blink::WebPushError::ErrorType error) { | |
| 255 blink::WebPushPermissionStatusCallbacks* callbacks = | 257 blink::WebPushPermissionStatusCallbacks* callbacks = |
| 256 permission_status_callbacks_.Lookup(request_id); | 258 permission_status_callbacks_.Lookup(request_id); |
| 257 if (!callbacks) | 259 if (!callbacks) |
| 258 return; | 260 return; |
| 259 | 261 |
| 260 callbacks->onError(); | 262 std::string error_message; |
| 263 if (error == blink::WebPushError::ErrorTypeNotSupported) { | |
| 264 error_message = | |
| 265 "Push subscriptions that don't enable userVisibleOnly are not " | |
| 266 "supported."; | |
| 267 } | |
| 268 | |
| 269 scoped_ptr<blink::WebPushError> web_error(new blink::WebPushError( | |
| 270 error, blink::WebString::fromUTF8(error_message))); | |
| 271 | |
| 272 callbacks->onError(web_error.release()); | |
|
Avi (use Gerrit)
2015/05/13 15:44:31
This bothers me because the definition of onError
| |
| 261 | 273 |
| 262 permission_status_callbacks_.Remove(request_id); | 274 permission_status_callbacks_.Remove(request_id); |
| 263 } | 275 } |
| 264 | 276 |
| 265 } // namespace content | 277 } // namespace content |
| OLD | NEW |