| 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 if (!notification_resources.image.drawsNothing()) { |
| 463 notification.set_type(message_center::NOTIFICATION_TYPE_IMAGE); |
| 464 notification.set_image( |
| 465 gfx::Image::CreateFrom1xBitmap(notification_resources.image)); |
| 466 } |
| 467 |
| 462 // Badges are only supported on Android, primarily because it's the only | 468 // Badges are only supported on Android, primarily because it's the only |
| 463 // platform that makes good use of them in the status bar. | 469 // 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. | |
| 465 #if defined(OS_ANDROID) | 470 #if defined(OS_ANDROID) |
| 466 // TODO(peter): Handle different screen densities instead of always using the | 471 // TODO(peter): Handle different screen densities instead of always using the |
| 467 // 1x bitmap - crbug.com/585815. | 472 // 1x bitmap - crbug.com/585815. |
| 468 notification.set_small_image( | 473 notification.set_small_image( |
| 469 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); | 474 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); |
| 470 #endif // defined(OS_ANDROID) | 475 #endif // defined(OS_ANDROID) |
| 471 | 476 |
| 472 // Developer supplied action buttons. | 477 // Developer supplied action buttons. |
| 473 std::vector<message_center::ButtonInfo> buttons; | 478 std::vector<message_center::ButtonInfo> buttons; |
| 474 for (size_t i = 0; i < notification_data.actions.size(); i++) { | 479 for (size_t i = 0; i < notification_data.actions.size(); i++) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 } | 518 } |
| 514 #endif | 519 #endif |
| 515 | 520 |
| 516 return base::string16(); | 521 return base::string16(); |
| 517 } | 522 } |
| 518 | 523 |
| 519 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 524 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 520 NotificationDisplayService* display_service) { | 525 NotificationDisplayService* display_service) { |
| 521 test_display_service_ = display_service; | 526 test_display_service_ = display_service; |
| 522 } | 527 } |
| OLD | NEW |