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/browser/push_messaging/push_messaging_router.h" | 5 #include "content/browser/push_messaging/push_messaging_router.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 8 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
9 #include "content/browser/service_worker/service_worker_registration.h" | 9 #include "content/browser/service_worker/service_worker_registration.h" |
10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // static | 42 // static |
43 void PushMessagingRouter::FindServiceWorkerRegistration( | 43 void PushMessagingRouter::FindServiceWorkerRegistration( |
44 const GURL& origin, | 44 const GURL& origin, |
45 int64 service_worker_registration_id, | 45 int64 service_worker_registration_id, |
46 const std::string& data, | 46 const std::string& data, |
47 const DeliverMessageCallback& deliver_message_callback, | 47 const DeliverMessageCallback& deliver_message_callback, |
48 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) { | 48 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) { |
49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
50 // Try to acquire the registration from storage. If it's already live we'll | 50 // Try to acquire the registration from storage. If it's already live we'll |
51 // receive it right away. If not, it will be revived from storage. | 51 // receive it right away. If not, it will be revived from storage. |
52 service_worker_context->context()->storage()->FindRegistrationForId( | 52 service_worker_context->FindRegistrationForId( |
53 service_worker_registration_id, | 53 service_worker_registration_id, |
54 origin, | 54 origin, |
55 base::Bind(&PushMessagingRouter::FindServiceWorkerRegistrationCallback, | 55 base::Bind(&PushMessagingRouter::FindServiceWorkerRegistrationCallback, |
56 data, | 56 data, |
57 deliver_message_callback)); | 57 deliver_message_callback)); |
58 } | 58 } |
59 | 59 |
60 // static | 60 // static |
61 void PushMessagingRouter::FindServiceWorkerRegistrationCallback( | 61 void PushMessagingRouter::FindServiceWorkerRegistrationCallback( |
62 const std::string& data, | 62 const std::string& data, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; | 123 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; |
124 break; | 124 break; |
125 } | 125 } |
126 BrowserThread::PostTask( | 126 BrowserThread::PostTask( |
127 BrowserThread::UI, | 127 BrowserThread::UI, |
128 FROM_HERE, | 128 FROM_HERE, |
129 base::Bind(deliver_message_callback, delivery_status)); | 129 base::Bind(deliver_message_callback, delivery_status)); |
130 } | 130 } |
131 | 131 |
132 } // namespace content | 132 } // namespace content |
OLD | NEW |