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/renderer/push_messaging_dispatcher.h" | 5 #include "content/renderer/push_messaging_dispatcher.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 8 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
9 #include "content/common/push_messaging_messages.h" | 9 #include "content/common/push_messaging_messages.h" |
10 #include "content/renderer/manifest/manifest_manager.h" | 10 #include "content/renderer/manifest/manifest_manager.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 scoped_ptr<blink::WebPushRegistration> registration( | 79 scoped_ptr<blink::WebPushRegistration> registration( |
80 new blink::WebPushRegistration( | 80 new blink::WebPushRegistration( |
81 WebString::fromUTF8(endpoint.spec()), | 81 WebString::fromUTF8(endpoint.spec()), |
82 WebString::fromUTF8(registration_id))); | 82 WebString::fromUTF8(registration_id))); |
83 callbacks->onSuccess(registration.release()); | 83 callbacks->onSuccess(registration.release()); |
84 registration_callbacks_.Remove(callbacks_id); | 84 registration_callbacks_.Remove(callbacks_id); |
85 } | 85 } |
86 | 86 |
87 void PushMessagingDispatcher::OnRegisterError(int32 callbacks_id, | 87 void PushMessagingDispatcher::OnRegisterError(int32 callbacks_id, |
88 PushMessagingStatus status) { | 88 PushRegistrationStatus status) { |
89 blink::WebPushRegistrationCallbacks* callbacks = | 89 blink::WebPushRegistrationCallbacks* callbacks = |
90 registration_callbacks_.Lookup(callbacks_id); | 90 registration_callbacks_.Lookup(callbacks_id); |
91 CHECK(callbacks); | 91 CHECK(callbacks); |
92 | 92 |
93 scoped_ptr<blink::WebPushError> error(new blink::WebPushError( | 93 scoped_ptr<blink::WebPushError> error(new blink::WebPushError( |
94 blink::WebPushError::ErrorTypeAbort, | 94 blink::WebPushError::ErrorTypeAbort, |
95 WebString::fromUTF8(PushMessagingStatusToString(status)))); | 95 WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
96 callbacks->onError(error.release()); | 96 callbacks->onError(error.release()); |
97 registration_callbacks_.Remove(callbacks_id); | 97 registration_callbacks_.Remove(callbacks_id); |
98 } | 98 } |
99 | 99 |
100 } // namespace content | 100 } // namespace content |
OLD | NEW |