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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int64 service_worker_registration_id, const GURL& origin, | 60 int64 service_worker_registration_id, const GURL& origin, |
61 const std::string& data, | 61 const std::string& data, |
62 const PushMessagingService::ResultCallback& callback) { | 62 const PushMessagingService::ResultCallback& callback) { |
63 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 63 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
64 service_worker_context_wrapper->StoreRegistrationUserData( | 64 service_worker_context_wrapper->StoreRegistrationUserData( |
65 service_worker_registration_id, origin, | 65 service_worker_registration_id, origin, |
66 kNotificationsShownServiceWorkerKey, data, | 66 kNotificationsShownServiceWorkerKey, data, |
67 base::Bind(&CallResultCallbackFromIO, callback)); | 67 base::Bind(&CallResultCallbackFromIO, callback)); |
68 } | 68 } |
69 | 69 |
70 void ClearPushRegistrationIDOnIO( | 70 void ClearPushSubscriptionIDOnIO( |
71 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, | 71 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, |
72 int64 service_worker_registration_id, | 72 int64 service_worker_registration_id, |
73 const base::Closure& callback) { | 73 const base::Closure& callback) { |
74 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
75 | 75 |
76 service_worker_context->ClearRegistrationUserData( | 76 service_worker_context->ClearRegistrationUserData( |
77 service_worker_registration_id, | 77 service_worker_registration_id, |
78 kPushRegistrationIdServiceWorkerKey, | 78 kPushRegistrationIdServiceWorkerKey, |
79 base::Bind(&CallClosureFromIO, callback)); | 79 base::Bind(&CallClosureFromIO, callback)); |
80 } | 80 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 BrowserThread::IO, | 135 BrowserThread::IO, |
136 FROM_HERE, | 136 FROM_HERE, |
137 base::Bind(&GetUserDataOnIO, | 137 base::Bind(&GetUserDataOnIO, |
138 GetServiceWorkerContext(browser_context, origin), | 138 GetServiceWorkerContext(browser_context, origin), |
139 service_worker_registration_id, | 139 service_worker_registration_id, |
140 kPushSenderIdServiceWorkerKey, | 140 kPushSenderIdServiceWorkerKey, |
141 callback)); | 141 callback)); |
142 } | 142 } |
143 | 143 |
144 // static | 144 // static |
145 void PushMessagingService::ClearPushRegistrationID( | 145 void PushMessagingService::ClearPushSubscriptionID( |
146 BrowserContext* browser_context, | 146 BrowserContext* browser_context, |
147 const GURL& origin, | 147 const GURL& origin, |
148 int64 service_worker_registration_id, | 148 int64 service_worker_registration_id, |
149 const base::Closure& callback) { | 149 const base::Closure& callback) { |
150 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 150 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
151 BrowserThread::PostTask( | 151 BrowserThread::PostTask( |
152 BrowserThread::IO, | 152 BrowserThread::IO, |
153 FROM_HERE, | 153 FROM_HERE, |
154 base::Bind(&ClearPushRegistrationIDOnIO, | 154 base::Bind(&ClearPushSubscriptionIDOnIO, |
155 GetServiceWorkerContext(browser_context, origin), | 155 GetServiceWorkerContext(browser_context, origin), |
156 service_worker_registration_id, | 156 service_worker_registration_id, |
157 callback)); | 157 callback)); |
158 } | 158 } |
159 | 159 |
160 } // namespace content | 160 } // namespace content |
OLD | NEW |