| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/public/browser/push_messaging_service.h" | 5 #include "content/public/browser/push_messaging_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "content/browser/push_messaging/push_messaging_message_filter.h" | 8 #include "content/browser/push_messaging/push_messaging_message_filter.h" |
| 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 120 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 121 base::Bind(&SetNotificationsShownOnIO, | 121 base::Bind(&SetNotificationsShownOnIO, |
| 122 wrapper, | 122 wrapper, |
| 123 service_worker_registration_id, | 123 service_worker_registration_id, |
| 124 origin, | 124 origin, |
| 125 notifications_shown, | 125 notifications_shown, |
| 126 callback)); | 126 callback)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // static | 129 // static |
| 130 void PushMessagingService::GetSenderId(BrowserContext* browser_context, | |
| 131 const GURL& origin, | |
| 132 int64_t service_worker_registration_id, | |
| 133 const StringCallback& callback) { | |
| 134 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 135 BrowserThread::PostTask( | |
| 136 BrowserThread::IO, | |
| 137 FROM_HERE, | |
| 138 base::Bind(&GetUserDataOnIO, | |
| 139 GetServiceWorkerContext(browser_context, origin), | |
| 140 service_worker_registration_id, | |
| 141 kPushSenderIdServiceWorkerKey, | |
| 142 callback)); | |
| 143 } | |
| 144 | |
| 145 // static | |
| 146 void PushMessagingService::ClearPushSubscriptionID( | 130 void PushMessagingService::ClearPushSubscriptionID( |
| 147 BrowserContext* browser_context, | 131 BrowserContext* browser_context, |
| 148 const GURL& origin, | 132 const GURL& origin, |
| 149 int64_t service_worker_registration_id, | 133 int64_t service_worker_registration_id, |
| 150 const base::Closure& callback) { | 134 const base::Closure& callback) { |
| 151 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 135 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 152 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
| 153 BrowserThread::IO, | 137 BrowserThread::IO, |
| 154 FROM_HERE, | 138 FROM_HERE, |
| 155 base::Bind(&ClearPushSubscriptionIDOnIO, | 139 base::Bind(&ClearPushSubscriptionIDOnIO, |
| 156 GetServiceWorkerContext(browser_context, origin), | 140 GetServiceWorkerContext(browser_context, origin), |
| 157 service_worker_registration_id, | 141 service_worker_registration_id, |
| 158 callback)); | 142 callback)); |
| 159 } | 143 } |
| 160 | 144 |
| 161 } // namespace content | 145 } // namespace content |
| OLD | NEW |