| 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, | 7 Notification::Notification(const GURL& origin_url, |
| 8 const GURL& icon_url, | |
| 9 const base::string16& title, | 8 const base::string16& title, |
| 10 const base::string16& body, | 9 const base::string16& body, |
| 11 blink::WebTextDirection dir, | 10 const gfx::Image& icon, |
| 12 const base::string16& display_source, | 11 const base::string16& display_source, |
| 13 const base::string16& replace_id, | 12 const base::string16& replace_id, |
| 14 NotificationDelegate* delegate) | 13 NotificationDelegate* delegate) |
| 15 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, | 14 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
| 16 delegate->id(), | 15 delegate->id(), |
| 17 title, | 16 title, |
| 18 body, | 17 body, |
| 19 gfx::Image(), | 18 icon, |
| 20 display_source, | 19 display_source, |
| 21 message_center::NotifierId(origin_url), | 20 message_center::NotifierId(origin_url), |
| 22 message_center::RichNotificationData(), | 21 message_center::RichNotificationData(), |
| 23 delegate), | 22 delegate), |
| 24 origin_url_(origin_url), | 23 origin_url_(origin_url), |
| 25 icon_url_(icon_url), | |
| 26 replace_id_(replace_id), | 24 replace_id_(replace_id), |
| 27 delegate_(delegate) {} | 25 delegate_(delegate) {} |
| 28 | 26 |
| 29 Notification::Notification( | 27 Notification::Notification( |
| 30 message_center::NotificationType type, | 28 message_center::NotificationType type, |
| 31 const GURL& origin_url, | 29 const GURL& origin_url, |
| 32 const base::string16& title, | 30 const base::string16& title, |
| 33 const base::string16& body, | 31 const base::string16& body, |
| 34 const gfx::Image& icon, | 32 const gfx::Image& icon, |
| 35 blink::WebTextDirection dir, | 33 blink::WebTextDirection dir, |
| 36 const message_center::NotifierId& notifier_id, | 34 const message_center::NotifierId& notifier_id, |
| 37 const base::string16& display_source, | 35 const base::string16& display_source, |
| 38 const base::string16& replace_id, | 36 const base::string16& replace_id, |
| 39 const message_center::RichNotificationData& rich_notification_data, | 37 const message_center::RichNotificationData& rich_notification_data, |
| 40 NotificationDelegate* delegate) | 38 NotificationDelegate* delegate) |
| 41 : message_center::Notification(type, | 39 : message_center::Notification(type, |
| 42 delegate->id(), | 40 delegate->id(), |
| 43 title, | 41 title, |
| 44 body, | 42 body, |
| 45 icon, | 43 icon, |
| 46 display_source, | 44 display_source, |
| 47 notifier_id, | 45 notifier_id, |
| 48 rich_notification_data, | 46 rich_notification_data, |
| 49 delegate), | 47 delegate), |
| 50 origin_url_(origin_url), | 48 origin_url_(origin_url), |
| 51 replace_id_(replace_id), | 49 replace_id_(replace_id), |
| 52 delegate_(delegate) { | 50 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 | 51 |
| 57 Notification::Notification(const std::string& id, | 52 Notification::Notification(const std::string& id, |
| 58 const Notification& notification) | 53 const Notification& notification) |
| 59 : message_center::Notification(id, notification), | 54 : message_center::Notification(id, notification), |
| 60 origin_url_(notification.origin_url()), | 55 origin_url_(notification.origin_url()), |
| 61 icon_url_(notification.icon_url()), | |
| 62 button_one_icon_url_(notification.button_one_icon_url()), | 56 button_one_icon_url_(notification.button_one_icon_url()), |
| 63 button_two_icon_url_(notification.button_two_icon_url()), | 57 button_two_icon_url_(notification.button_two_icon_url()), |
| 64 image_url_(notification.image_url()), | 58 image_url_(notification.image_url()), |
| 65 replace_id_(notification.replace_id()), | 59 replace_id_(notification.replace_id()), |
| 66 delegate_(notification.delegate()) { | 60 delegate_(notification.delegate()) { |
| 67 } | 61 } |
| 68 | 62 |
| 69 Notification::Notification(const Notification& notification) | 63 Notification::Notification(const Notification& notification) |
| 70 : message_center::Notification(notification), | 64 : message_center::Notification(notification), |
| 71 origin_url_(notification.origin_url()), | 65 origin_url_(notification.origin_url()), |
| 72 icon_url_(notification.icon_url()), | |
| 73 button_one_icon_url_(notification.button_one_icon_url()), | 66 button_one_icon_url_(notification.button_one_icon_url()), |
| 74 button_two_icon_url_(notification.button_two_icon_url()), | 67 button_two_icon_url_(notification.button_two_icon_url()), |
| 75 image_url_(notification.image_url()), | 68 image_url_(notification.image_url()), |
| 76 replace_id_(notification.replace_id()), | 69 replace_id_(notification.replace_id()), |
| 77 delegate_(notification.delegate()) {} | 70 delegate_(notification.delegate()) {} |
| 78 | 71 |
| 79 Notification::~Notification() {} | 72 Notification::~Notification() {} |
| 80 | 73 |
| 81 Notification& Notification::operator=(const Notification& notification) { | 74 Notification& Notification::operator=(const Notification& notification) { |
| 82 message_center::Notification::operator=(notification); | 75 message_center::Notification::operator=(notification); |
| 83 origin_url_ = notification.origin_url(); | 76 origin_url_ = notification.origin_url(); |
| 84 icon_url_ = notification.icon_url(); | |
| 85 button_one_icon_url_ = notification.button_one_icon_url(); | 77 button_one_icon_url_ = notification.button_one_icon_url(); |
| 86 button_two_icon_url_ = notification.button_two_icon_url(); | 78 button_two_icon_url_ = notification.button_two_icon_url(); |
| 87 image_url_ = notification.image_url(); | 79 image_url_ = notification.image_url(); |
| 88 replace_id_ = notification.replace_id(); | 80 replace_id_ = notification.replace_id(); |
| 89 delegate_ = notification.delegate(); | 81 delegate_ = notification.delegate(); |
| 90 return *this; | 82 return *this; |
| 91 } | 83 } |
| OLD | NEW |