OLD | NEW |
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 Notification& notification) | 32 Notification::Notification(const Notification& notification) |
58 : message_center::Notification(notification), | 33 : message_center::Notification(notification), |
59 origin_url_(notification.origin_url()), | 34 origin_url_(notification.origin_url()), |
60 icon_url_(notification.icon_url()), | |
61 button_one_icon_url_(notification.button_one_icon_url()), | 35 button_one_icon_url_(notification.button_one_icon_url()), |
62 button_two_icon_url_(notification.button_two_icon_url()), | 36 button_two_icon_url_(notification.button_two_icon_url()), |
63 image_url_(notification.image_url()), | 37 image_url_(notification.image_url()), |
64 replace_id_(notification.replace_id()), | 38 replace_id_(notification.replace_id()), |
65 delegate_(notification.delegate()) {} | 39 delegate_(notification.delegate()) {} |
66 | 40 |
67 Notification::~Notification() {} | 41 Notification::~Notification() {} |
68 | 42 |
69 Notification& Notification::operator=(const Notification& notification) { | 43 Notification& Notification::operator=(const Notification& notification) { |
70 message_center::Notification::operator=(notification); | 44 message_center::Notification::operator=(notification); |
71 origin_url_ = notification.origin_url(); | 45 origin_url_ = notification.origin_url(); |
72 icon_url_ = notification.icon_url(); | |
73 button_one_icon_url_ = notification.button_one_icon_url(); | 46 button_one_icon_url_ = notification.button_one_icon_url(); |
74 button_two_icon_url_ = notification.button_two_icon_url(); | 47 button_two_icon_url_ = notification.button_two_icon_url(); |
75 image_url_ = notification.image_url(); | 48 image_url_ = notification.image_url(); |
76 replace_id_ = notification.replace_id(); | 49 replace_id_ = notification.replace_id(); |
77 delegate_ = notification.delegate(); | 50 delegate_ = notification.delegate(); |
78 return *this; | 51 return *this; |
79 } | 52 } |
OLD | NEW |