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 <bitset> | 7 #include <bitset> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // already failed once in the previous 10 push messages, so we will show a | 255 // already failed once in the previous 10 push messages, so we will show a |
256 // generic notification. See https://crbug.com/437277. | 256 // generic notification. See https://crbug.com/437277. |
257 // TODO(johnme): The generic notification should probably automatically | 257 // TODO(johnme): The generic notification should probably automatically |
258 // close itself when the next push message arrives? | 258 // close itself when the next push message arrives? |
259 content::PlatformNotificationData notification_data; | 259 content::PlatformNotificationData notification_data; |
260 notification_data.title = | 260 notification_data.title = |
261 base::UTF8ToUTF16(net::registry_controlled_domains::GetDomainAndRegistry( | 261 base::UTF8ToUTF16(net::registry_controlled_domains::GetDomainAndRegistry( |
262 requesting_origin.host(), | 262 requesting_origin.host(), |
263 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); | 263 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
264 notification_data.direction = | 264 notification_data.direction = |
265 content::PlatformNotificationData::NotificationDirectionLeftToRight; | 265 content::PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT; |
266 notification_data.body = | 266 notification_data.body = |
267 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY); | 267 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY); |
268 notification_data.tag = kPushMessagingForcedNotificationTag; | 268 notification_data.tag = kPushMessagingForcedNotificationTag; |
269 notification_data.icon = GURL(); | 269 notification_data.icon = GURL(); |
270 notification_data.silent = true; | 270 notification_data.silent = true; |
271 | 271 |
272 content::NotificationDatabaseData database_data; | 272 content::NotificationDatabaseData database_data; |
273 database_data.origin = requesting_origin; | 273 database_data.origin = requesting_origin; |
274 database_data.service_worker_registration_id = | 274 database_data.service_worker_registration_id = |
275 service_worker_registration_id; | 275 service_worker_registration_id; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return; | 321 return; |
322 } | 322 } |
323 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( | 323 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( |
324 profile_, | 324 profile_, |
325 persistent_notification_id, | 325 persistent_notification_id, |
326 requesting_origin, | 326 requesting_origin, |
327 SkBitmap() /* icon */, | 327 SkBitmap() /* icon */, |
328 notification_data); | 328 notification_data); |
329 message_handled_closure.Run(); | 329 message_handled_closure.Run(); |
330 } | 330 } |
OLD | NEW |