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

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

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 origin, notification_data.tag, message_center::RichNotificationData(), 479 origin, notification_data.tag, message_center::RichNotificationData(),
480 delegate); 480 delegate);
481 481
482 notification.set_context_message( 482 notification.set_context_message(
483 DisplayNameForContextMessage(profile, origin)); 483 DisplayNameForContextMessage(profile, origin));
484 notification.set_vibration_pattern(notification_data.vibration_pattern); 484 notification.set_vibration_pattern(notification_data.vibration_pattern);
485 notification.set_timestamp(notification_data.timestamp); 485 notification.set_timestamp(notification_data.timestamp);
486 notification.set_renotify(notification_data.renotify); 486 notification.set_renotify(notification_data.renotify);
487 notification.set_silent(notification_data.silent); 487 notification.set_silent(notification_data.silent);
488 488
489 // TODO(peter): Handle different screen densities instead of always using the
490 // 1x bitmap - crbug.com/585815.
491 notification.set_small_image(
492 gfx::Image::CreateFrom1xBitmap(notification_resources.small_icon));
Peter Beverloo 2016/03/03 17:55:38 What does this actually do on desktop? Do we try t
Michael van Ouwerkerk 2016/03/09 18:28:25 If there are no buttons, they render on top of eac
493
489 // Developer supplied action buttons. 494 // Developer supplied action buttons.
490 std::vector<message_center::ButtonInfo> buttons; 495 std::vector<message_center::ButtonInfo> buttons;
491 for (size_t i = 0; i < notification_data.actions.size(); i++) { 496 for (size_t i = 0; i < notification_data.actions.size(); i++) {
492 message_center::ButtonInfo button(notification_data.actions[i].title); 497 message_center::ButtonInfo button(notification_data.actions[i].title);
493 // TODO(peter): Handle different screen densities instead of always using 498 // TODO(peter): Handle different screen densities instead of always using
494 // the 1x bitmap - crbug.com/585815. 499 // the 1x bitmap - crbug.com/585815.
495 button.icon = 500 button.icon =
496 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); 501 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]);
497 buttons.push_back(button); 502 buttons.push_back(button);
498 } 503 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( 560 extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
556 origin.host(), extensions::ExtensionRegistry::EVERYTHING); 561 origin.host(), extensions::ExtensionRegistry::EVERYTHING);
557 DCHECK(extension); 562 DCHECK(extension);
558 563
559 return base::UTF8ToUTF16(extension->name()); 564 return base::UTF8ToUTF16(extension->name());
560 } 565 }
561 #endif 566 #endif
562 567
563 return base::string16(); 568 return base::string16();
564 } 569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698