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 "chrome/browser/push_messaging/push_messaging_notification_manager.h" | 5 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <bitset> | 9 #include <bitset> |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 break; | 186 break; |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 if (notification_needed && !notification_shown) { | 190 if (notification_needed && !notification_shown) { |
191 // If the worker needed to show a notification and didn't, see if a silent | 191 // If the worker needed to show a notification and didn't, see if a silent |
192 // push was allowed. | 192 // push was allowed. |
193 BudgetManager* manager = BudgetManagerFactory::GetForProfile(profile_); | 193 BudgetManager* manager = BudgetManagerFactory::GetForProfile(profile_); |
194 manager->Consume( | 194 manager->Consume( |
195 origin, blink::mojom::BudgetOperationType::SILENT_PUSH, | 195 url::Origin(origin), blink::mojom::BudgetOperationType::SILENT_PUSH, |
196 base::Bind(&PushMessagingNotificationManager::ProcessSilentPush, | 196 base::Bind(&PushMessagingNotificationManager::ProcessSilentPush, |
197 weak_factory_.GetWeakPtr(), origin, | 197 weak_factory_.GetWeakPtr(), origin, |
198 service_worker_registration_id, message_handled_closure)); | 198 service_worker_registration_id, message_handled_closure)); |
199 return; | 199 return; |
200 } | 200 } |
201 | 201 |
202 if (notification_needed && notification_shown) { | 202 if (notification_needed && notification_shown) { |
203 RecordUserVisibleStatus( | 203 RecordUserVisibleStatus( |
204 content::PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN); | 204 content::PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN); |
205 } else if (!notification_needed && !notification_shown) { | 205 } else if (!notification_needed && !notification_shown) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Do not pass service worker scope. The origin will be used instead of the | 317 // Do not pass service worker scope. The origin will be used instead of the |
318 // service worker scope to determine whether a notification should be | 318 // service worker scope to determine whether a notification should be |
319 // attributed to a WebAPK on Android. This is OK because this code path is hit | 319 // attributed to a WebAPK on Android. This is OK because this code path is hit |
320 // rarely. | 320 // rarely. |
321 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( | 321 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( |
322 profile_, persistent_notification_id, GURL() /* service_worker_scope */, | 322 profile_, persistent_notification_id, GURL() /* service_worker_scope */, |
323 origin, notification_data, NotificationResources()); | 323 origin, notification_data, NotificationResources()); |
324 | 324 |
325 message_handled_closure.Run(); | 325 message_handled_closure.Run(); |
326 } | 326 } |
OLD | NEW |