| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 origin, notification_data.tag, message_center::RichNotificationData(), | 462 origin, notification_data.tag, message_center::RichNotificationData(), |
| 463 delegate); | 463 delegate); |
| 464 | 464 |
| 465 notification.set_context_message( | 465 notification.set_context_message( |
| 466 DisplayNameForContextMessage(profile, origin)); | 466 DisplayNameForContextMessage(profile, origin)); |
| 467 notification.set_vibration_pattern(notification_data.vibration_pattern); | 467 notification.set_vibration_pattern(notification_data.vibration_pattern); |
| 468 notification.set_timestamp(notification_data.timestamp); | 468 notification.set_timestamp(notification_data.timestamp); |
| 469 notification.set_renotify(notification_data.renotify); | 469 notification.set_renotify(notification_data.renotify); |
| 470 notification.set_silent(notification_data.silent); | 470 notification.set_silent(notification_data.silent); |
| 471 | 471 |
| 472 // Badges are only supported on Android, primarily because it's the only |
| 473 // platform that makes good use of them in the status bar. |
| 474 // TODO(mvanouwerkerk): ensure no badge is loaded when it will not be used. |
| 475 #if defined(OS_ANDROID) |
| 472 // TODO(peter): Handle different screen densities instead of always using the | 476 // TODO(peter): Handle different screen densities instead of always using the |
| 473 // 1x bitmap - crbug.com/585815. | 477 // 1x bitmap - crbug.com/585815. |
| 474 notification.set_small_image( | 478 notification.set_small_image( |
| 475 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); | 479 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); |
| 480 #endif // defined(OS_ANDROID) |
| 476 | 481 |
| 477 // Developer supplied action buttons. | 482 // Developer supplied action buttons. |
| 478 std::vector<message_center::ButtonInfo> buttons; | 483 std::vector<message_center::ButtonInfo> buttons; |
| 479 for (size_t i = 0; i < notification_data.actions.size(); i++) { | 484 for (size_t i = 0; i < notification_data.actions.size(); i++) { |
| 480 message_center::ButtonInfo button(notification_data.actions[i].title); | 485 message_center::ButtonInfo button(notification_data.actions[i].title); |
| 481 // TODO(peter): Handle different screen densities instead of always using | 486 // TODO(peter): Handle different screen densities instead of always using |
| 482 // the 1x bitmap - crbug.com/585815. | 487 // the 1x bitmap - crbug.com/585815. |
| 483 button.icon = | 488 button.icon = |
| 484 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); | 489 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); |
| 485 buttons.push_back(button); | 490 buttons.push_back(button); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 544 } |
| 540 #endif | 545 #endif |
| 541 | 546 |
| 542 return base::string16(); | 547 return base::string16(); |
| 543 } | 548 } |
| 544 | 549 |
| 545 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 550 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 546 NotificationDisplayService* display_service) { | 551 NotificationDisplayService* display_service) { |
| 547 test_display_service_ = display_service; | 552 test_display_service_ = display_service; |
| 548 } | 553 } |
| OLD | NEW |