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
3 // found in the LICENSE file.
5 #include "chrome/browser/notifications/notification.h"
7 Notification::Notification(const GURL& origin_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,
21 message_center::NotifierId(origin_url),
22 message_center::RichNotificationData(),
24 origin_url_(origin_url),
26 replace_id_(replace_id),
27 delegate_(delegate) {}
29 Notification::Notification(
30 message_center::NotificationType type,
31 const GURL& origin_url,
32 const base::string16& title,
33 const base::string16& body,
34 const gfx::Image& icon,
35 blink::WebTextDirection dir,
36 const message_center::NotifierId& notifier_id,
37 const base::string16& display_source,
38 const base::string16& replace_id,
39 const message_center::RichNotificationData& rich_notification_data,
40 NotificationDelegate* delegate)
41 : message_center::Notification(type,
48 rich_notification_data,
50 origin_url_(origin_url),
51 replace_id_(replace_id),
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|.
57 Notification::Notification(const Notification& notification)
58 : message_center::Notification(notification),
59 origin_url_(notification.origin_url()),
60 icon_url_(notification.icon_url()),
61 button_one_icon_url_(notification.button_one_icon_url()),
62 button_two_icon_url_(notification.button_two_icon_url()),
63 image_url_(notification.image_url()),
64 replace_id_(notification.replace_id()),
65 delegate_(notification.delegate()) {}
67 Notification::~Notification() {}
69 Notification& Notification::operator=(const Notification& notification) {
70 message_center::Notification::operator=(notification);
71 origin_url_ = notification.origin_url();
72 icon_url_ = notification.icon_url();
73 button_one_icon_url_ = notification.button_one_icon_url();
74 button_two_icon_url_ = notification.button_two_icon_url();
75 image_url_ = notification.image_url();
76 replace_id_ = notification.replace_id();
77 delegate_ = notification.delegate();