Chromium Code Reviews| 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 "chrome/browser/notifications/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 delegate); | 452 delegate); |
| 453 | 453 |
| 454 notification.set_service_worker_scope(service_worker_scope); | 454 notification.set_service_worker_scope(service_worker_scope); |
| 455 notification.set_context_message( | 455 notification.set_context_message( |
| 456 DisplayNameForContextMessage(profile, origin)); | 456 DisplayNameForContextMessage(profile, origin)); |
| 457 notification.set_vibration_pattern(notification_data.vibration_pattern); | 457 notification.set_vibration_pattern(notification_data.vibration_pattern); |
| 458 notification.set_timestamp(notification_data.timestamp); | 458 notification.set_timestamp(notification_data.timestamp); |
| 459 notification.set_renotify(notification_data.renotify); | 459 notification.set_renotify(notification_data.renotify); |
| 460 notification.set_silent(notification_data.silent); | 460 notification.set_silent(notification_data.silent); |
| 461 | 461 |
| 462 // TODO(johnme): ensure image is not loaded when it will not be used. | |
|
Peter Beverloo
2016/08/22 20:11:07
I get why you have this TODO here, but this really
johnme
2016/08/23 14:59:49
Done. Moved the badge one too.
| |
| 463 if (!notification_resources.image.drawsNothing()) { | |
| 464 notification.set_type(message_center::NOTIFICATION_TYPE_IMAGE); | |
| 465 notification.set_image( | |
| 466 gfx::Image::CreateFrom1xBitmap(notification_resources.image)); | |
| 467 } | |
| 468 | |
| 462 // Badges are only supported on Android, primarily because it's the only | 469 // Badges are only supported on Android, primarily because it's the only |
| 463 // platform that makes good use of them in the status bar. | 470 // platform that makes good use of them in the status bar. |
| 464 // TODO(mvanouwerkerk): ensure no badge is loaded when it will not be used. | 471 // TODO(mvanouwerkerk): ensure no badge is loaded when it will not be used. |
| 465 #if defined(OS_ANDROID) | 472 #if defined(OS_ANDROID) |
| 466 // TODO(peter): Handle different screen densities instead of always using the | 473 // TODO(peter): Handle different screen densities instead of always using the |
| 467 // 1x bitmap - crbug.com/585815. | 474 // 1x bitmap - crbug.com/585815. |
| 468 notification.set_small_image( | 475 notification.set_small_image( |
| 469 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); | 476 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); |
| 470 #endif // defined(OS_ANDROID) | 477 #endif // defined(OS_ANDROID) |
| 471 | 478 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 } | 520 } |
| 514 #endif | 521 #endif |
| 515 | 522 |
| 516 return base::string16(); | 523 return base::string16(); |
| 517 } | 524 } |
| 518 | 525 |
| 519 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 526 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 520 NotificationDisplayService* display_service) { | 527 NotificationDisplayService* display_service) { |
| 521 test_display_service_ = display_service; | 528 test_display_service_ = display_service; |
| 522 } | 529 } |
| OLD | NEW |