Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 2006743002: Notification badges are only supported on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698