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

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

Issue 554213003: Request the icon of a Web Notification in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes now redundant code Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notification.h" 5 #include "chrome/browser/notifications/notification.h"
6 6
7 Notification::Notification(const GURL& origin_url,
8 const GURL& icon_url,
9 const base::string16& title,
10 const base::string16& body,
11 blink::WebTextDirection dir,
12 const base::string16& display_source,
13 const base::string16& replace_id,
14 NotificationDelegate* delegate)
15 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE,
16 delegate->id(),
17 title,
18 body,
19 gfx::Image(),
20 display_source,
21 message_center::NotifierId(origin_url),
22 message_center::RichNotificationData(),
23 delegate),
24 origin_url_(origin_url),
25 icon_url_(icon_url),
26 replace_id_(replace_id),
27 delegate_(delegate) {}
28
29 Notification::Notification( 7 Notification::Notification(
30 message_center::NotificationType type, 8 message_center::NotificationType type,
31 const GURL& origin_url, 9 const GURL& origin_url,
32 const base::string16& title, 10 const base::string16& title,
33 const base::string16& body, 11 const base::string16& body,
34 const gfx::Image& icon, 12 const gfx::Image& icon,
35 blink::WebTextDirection dir, 13 blink::WebTextDirection dir,
36 const message_center::NotifierId& notifier_id, 14 const message_center::NotifierId& notifier_id,
37 const base::string16& display_source, 15 const base::string16& display_source,
38 const base::string16& replace_id, 16 const base::string16& replace_id,
39 const message_center::RichNotificationData& rich_notification_data, 17 const message_center::RichNotificationData& rich_notification_data,
40 NotificationDelegate* delegate) 18 NotificationDelegate* delegate)
41 : message_center::Notification(type, 19 : message_center::Notification(type,
42 delegate->id(), 20 delegate->id(),
43 title, 21 title,
44 body, 22 body,
45 icon, 23 icon,
46 display_source, 24 display_source,
47 notifier_id, 25 notifier_id,
48 rich_notification_data, 26 rich_notification_data,
49 delegate), 27 delegate),
50 origin_url_(origin_url), 28 origin_url_(origin_url),
51 replace_id_(replace_id), 29 replace_id_(replace_id),
52 delegate_(delegate) { 30 delegate_(delegate) {}
53 // It's important to leave |icon_url_| empty with rich notifications enabled,
54 // to prevent "Downloading" the data url and overwriting the existing |icon|.
55 }
56 31
57 Notification::Notification(const GURL& origin_url, 32 Notification::Notification(const GURL& origin_url,
58 const gfx::Image& icon, 33 const gfx::Image& icon,
59 const base::string16& title, 34 const base::string16& title,
60 const base::string16& body, 35 const base::string16& body,
61 blink::WebTextDirection dir, 36 blink::WebTextDirection dir,
62 const base::string16& display_source, 37 const base::string16& display_source,
63 const base::string16& replace_id, 38 const base::string16& replace_id,
64 NotificationDelegate* delegate) 39 NotificationDelegate* delegate)
65 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, 40 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE,
66 delegate->id(), 41 delegate->id(),
67 title, 42 title,
68 body, 43 body,
69 icon, 44 icon,
70 display_source, 45 display_source,
71 message_center::NotifierId(origin_url), 46 message_center::NotifierId(origin_url),
72 message_center::RichNotificationData(), 47 message_center::RichNotificationData(),
73 delegate), 48 delegate),
74 origin_url_(origin_url), 49 origin_url_(origin_url),
75 replace_id_(replace_id), 50 replace_id_(replace_id),
76 delegate_(delegate) {} 51 delegate_(delegate) {}
77 52
78 Notification::Notification(const Notification& notification) 53 Notification::Notification(const Notification& notification)
79 : message_center::Notification(notification), 54 : message_center::Notification(notification),
80 origin_url_(notification.origin_url()), 55 origin_url_(notification.origin_url()),
81 icon_url_(notification.icon_url()),
82 button_one_icon_url_(notification.button_one_icon_url()), 56 button_one_icon_url_(notification.button_one_icon_url()),
83 button_two_icon_url_(notification.button_two_icon_url()), 57 button_two_icon_url_(notification.button_two_icon_url()),
84 image_url_(notification.image_url()), 58 image_url_(notification.image_url()),
85 replace_id_(notification.replace_id()), 59 replace_id_(notification.replace_id()),
86 delegate_(notification.delegate()) {} 60 delegate_(notification.delegate()) {}
87 61
88 Notification::~Notification() {} 62 Notification::~Notification() {}
89 63
90 Notification& Notification::operator=(const Notification& notification) { 64 Notification& Notification::operator=(const Notification& notification) {
91 message_center::Notification::operator=(notification); 65 message_center::Notification::operator=(notification);
92 origin_url_ = notification.origin_url(); 66 origin_url_ = notification.origin_url();
93 icon_url_ = notification.icon_url();
94 button_one_icon_url_ = notification.button_one_icon_url(); 67 button_one_icon_url_ = notification.button_one_icon_url();
95 button_two_icon_url_ = notification.button_two_icon_url(); 68 button_two_icon_url_ = notification.button_two_icon_url();
96 image_url_ = notification.image_url(); 69 image_url_ = notification.image_url();
97 replace_id_ = notification.replace_id(); 70 replace_id_ = notification.replace_id();
98 delegate_ = notification.delegate(); 71 delegate_ = notification.delegate();
99 return *this; 72 return *this;
100 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698