| 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 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/browser/notifications/desktop_notification_service.h" | 8 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 9 #include "ui/base/webui/web_ui_util.h" | 9 #include "ui/base/webui/web_ui_util.h" |
| 10 #include "ui/message_center/message_center_util.h" | 10 #include "ui/message_center/message_center_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 origin_url_(origin_url), | 26 origin_url_(origin_url), |
| 27 is_html_(true), | 27 is_html_(true), |
| 28 content_url_(content_url), | 28 content_url_(content_url), |
| 29 replace_id_(replace_id), | 29 replace_id_(replace_id), |
| 30 delegate_(delegate) {} | 30 delegate_(delegate) {} |
| 31 | 31 |
| 32 Notification::Notification(const GURL& origin_url, | 32 Notification::Notification(const GURL& origin_url, |
| 33 const GURL& icon_url, | 33 const GURL& icon_url, |
| 34 const string16& title, | 34 const string16& title, |
| 35 const string16& body, | 35 const string16& body, |
| 36 WebKit::WebTextDirection dir, | 36 blink::WebTextDirection dir, |
| 37 const string16& display_source, | 37 const string16& display_source, |
| 38 const string16& replace_id, | 38 const string16& replace_id, |
| 39 NotificationDelegate* delegate) | 39 NotificationDelegate* delegate) |
| 40 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, | 40 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
| 41 delegate->id(), | 41 delegate->id(), |
| 42 title, | 42 title, |
| 43 body, | 43 body, |
| 44 gfx::Image(), | 44 gfx::Image(), |
| 45 display_source, | 45 display_source, |
| 46 message_center::NotifierId(origin_url), | 46 message_center::NotifierId(origin_url), |
| 47 message_center::RichNotificationData(), | 47 message_center::RichNotificationData(), |
| 48 delegate), | 48 delegate), |
| 49 origin_url_(origin_url), | 49 origin_url_(origin_url), |
| 50 icon_url_(icon_url), | 50 icon_url_(icon_url), |
| 51 is_html_(false), | 51 is_html_(false), |
| 52 replace_id_(replace_id), | 52 replace_id_(replace_id), |
| 53 delegate_(delegate) { | 53 delegate_(delegate) { |
| 54 // "Upconvert" the string parameters to a data: URL. | 54 // "Upconvert" the string parameters to a data: URL. |
| 55 content_url_ = GURL(DesktopNotificationService::CreateDataUrl( | 55 content_url_ = GURL(DesktopNotificationService::CreateDataUrl( |
| 56 icon_url, title, body, dir)); | 56 icon_url, title, body, dir)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 Notification::Notification( | 59 Notification::Notification( |
| 60 message_center::NotificationType type, | 60 message_center::NotificationType type, |
| 61 const GURL& origin_url, | 61 const GURL& origin_url, |
| 62 const string16& title, | 62 const string16& title, |
| 63 const string16& body, | 63 const string16& body, |
| 64 const gfx::Image& icon, | 64 const gfx::Image& icon, |
| 65 WebKit::WebTextDirection dir, | 65 blink::WebTextDirection dir, |
| 66 const message_center::NotifierId& notifier_id, | 66 const message_center::NotifierId& notifier_id, |
| 67 const string16& display_source, | 67 const string16& display_source, |
| 68 const string16& replace_id, | 68 const string16& replace_id, |
| 69 const message_center::RichNotificationData& rich_notification_data, | 69 const message_center::RichNotificationData& rich_notification_data, |
| 70 NotificationDelegate* delegate) | 70 NotificationDelegate* delegate) |
| 71 : message_center::Notification(type, | 71 : message_center::Notification(type, |
| 72 delegate->id(), | 72 delegate->id(), |
| 73 title, | 73 title, |
| 74 body, | 74 body, |
| 75 icon, | 75 icon, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 icon_url_ = GURL(webui::GetBitmapDataUrl(*icon.ToSkBitmap())); | 90 icon_url_ = GURL(webui::GetBitmapDataUrl(*icon.ToSkBitmap())); |
| 91 content_url_ = GURL( | 91 content_url_ = GURL( |
| 92 DesktopNotificationService::CreateDataUrl(icon_url_, title, body, dir)); | 92 DesktopNotificationService::CreateDataUrl(icon_url_, title, body, dir)); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 Notification::Notification(const GURL& origin_url, | 96 Notification::Notification(const GURL& origin_url, |
| 97 const gfx::Image& icon, | 97 const gfx::Image& icon, |
| 98 const string16& title, | 98 const string16& title, |
| 99 const string16& body, | 99 const string16& body, |
| 100 WebKit::WebTextDirection dir, | 100 blink::WebTextDirection dir, |
| 101 const string16& display_source, | 101 const string16& display_source, |
| 102 const string16& replace_id, | 102 const string16& replace_id, |
| 103 NotificationDelegate* delegate) | 103 NotificationDelegate* delegate) |
| 104 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, | 104 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
| 105 delegate->id(), | 105 delegate->id(), |
| 106 title, | 106 title, |
| 107 body, | 107 body, |
| 108 icon, | 108 icon, |
| 109 display_source, | 109 display_source, |
| 110 message_center::NotifierId(origin_url), | 110 message_center::NotifierId(origin_url), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 135 icon_url_ = notification.icon_url(); | 135 icon_url_ = notification.icon_url(); |
| 136 is_html_ = notification.is_html(); | 136 is_html_ = notification.is_html(); |
| 137 content_url_ = notification.content_url(); | 137 content_url_ = notification.content_url(); |
| 138 button_one_icon_url_ = notification.button_one_icon_url(); | 138 button_one_icon_url_ = notification.button_one_icon_url(); |
| 139 button_two_icon_url_ = notification.button_two_icon_url(); | 139 button_two_icon_url_ = notification.button_two_icon_url(); |
| 140 image_url_ = notification.image_url(); | 140 image_url_ = notification.image_url(); |
| 141 replace_id_ = notification.replace_id(); | 141 replace_id_ = notification.replace_id(); |
| 142 delegate_ = notification.delegate(); | 142 delegate_ = notification.delegate(); |
| 143 return *this; | 143 return *this; |
| 144 } | 144 } |
| OLD | NEW |