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 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: crbug.com/591394#c4 | |
|
Peter Beverloo
2016/05/23 15:40:03
Can we summarize the reasoning here rather than li
Michael van Ouwerkerk
2016/05/23 16:12:26
Done.
| |
| 473 #if defined(OS_ANDROID) | |
| 472 // TODO(peter): Handle different screen densities instead of always using the | 474 // TODO(peter): Handle different screen densities instead of always using the |
| 473 // 1x bitmap - crbug.com/585815. | 475 // 1x bitmap - crbug.com/585815. |
| 474 notification.set_small_image( | 476 notification.set_small_image( |
| 475 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); | 477 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); |
| 478 #endif // defined(OS_ANDROID) | |
| 476 | 479 |
| 477 // Developer supplied action buttons. | 480 // Developer supplied action buttons. |
| 478 std::vector<message_center::ButtonInfo> buttons; | 481 std::vector<message_center::ButtonInfo> buttons; |
| 479 for (size_t i = 0; i < notification_data.actions.size(); i++) { | 482 for (size_t i = 0; i < notification_data.actions.size(); i++) { |
| 480 message_center::ButtonInfo button(notification_data.actions[i].title); | 483 message_center::ButtonInfo button(notification_data.actions[i].title); |
| 481 // TODO(peter): Handle different screen densities instead of always using | 484 // TODO(peter): Handle different screen densities instead of always using |
| 482 // the 1x bitmap - crbug.com/585815. | 485 // the 1x bitmap - crbug.com/585815. |
| 483 button.icon = | 486 button.icon = |
| 484 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); | 487 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); |
| 485 buttons.push_back(button); | 488 buttons.push_back(button); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 } | 542 } |
| 540 #endif | 543 #endif |
| 541 | 544 |
| 542 return base::string16(); | 545 return base::string16(); |
| 543 } | 546 } |
| 544 | 547 |
| 545 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 548 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 546 NotificationDisplayService* display_service) { | 549 NotificationDisplayService* display_service) { |
| 547 test_display_service_ = display_service; | 550 test_display_service_ = display_service; |
| 548 } | 551 } |
| OLD | NEW |