| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 subscription_callbacks_.Remove(request_id); | 176 subscription_callbacks_.Remove(request_id); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) { | 179 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) { |
| 180 blink::WebPushUnsubscribeCallbacks* callbacks = | 180 blink::WebPushUnsubscribeCallbacks* callbacks = |
| 181 unsubscribe_callbacks_.Lookup(request_id); | 181 unsubscribe_callbacks_.Lookup(request_id); |
| 182 if (!callbacks) | 182 if (!callbacks) |
| 183 return; | 183 return; |
| 184 | 184 |
| 185 #ifdef CRBUG_493531 |
| 186 callbacks->onSuccess(new bool(did_unsubscribe)); |
| 187 #else |
| 185 callbacks->onSuccess(&did_unsubscribe); | 188 callbacks->onSuccess(&did_unsubscribe); |
| 189 #endif |
| 186 | 190 |
| 187 unsubscribe_callbacks_.Remove(request_id); | 191 unsubscribe_callbacks_.Remove(request_id); |
| 188 } | 192 } |
| 189 | 193 |
| 190 void PushProvider::OnUnsubscribeError( | 194 void PushProvider::OnUnsubscribeError( |
| 191 int request_id, | 195 int request_id, |
| 192 blink::WebPushError::ErrorType error_type, | 196 blink::WebPushError::ErrorType error_type, |
| 193 const std::string& error_message) { | 197 const std::string& error_message) { |
| 194 blink::WebPushUnsubscribeCallbacks* callbacks = | 198 blink::WebPushUnsubscribeCallbacks* callbacks = |
| 195 unsubscribe_callbacks_.Lookup(request_id); | 199 unsubscribe_callbacks_.Lookup(request_id); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 266 |
| 263 scoped_ptr<blink::WebPushError> web_error(new blink::WebPushError( | 267 scoped_ptr<blink::WebPushError> web_error(new blink::WebPushError( |
| 264 error, blink::WebString::fromUTF8(error_message))); | 268 error, blink::WebString::fromUTF8(error_message))); |
| 265 | 269 |
| 266 callbacks->onError(web_error.release()); | 270 callbacks->onError(web_error.release()); |
| 267 | 271 |
| 268 permission_status_callbacks_.Remove(request_id); | 272 permission_status_callbacks_.Remove(request_id); |
| 269 } | 273 } |
| 270 | 274 |
| 271 } // namespace content | 275 } // namespace content |
| OLD | NEW |