| 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 "chrome/browser/notifications/desktop_notification_service.h" | 7 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 8 | 8 |
| 9 Notification::Notification(const GURL& origin_url, | 9 Notification::Notification(const GURL& origin_url, |
| 10 const GURL& content_url, | 10 const GURL& content_url, |
| 11 const string16& display_source, | 11 const string16& display_source, |
| 12 const string16& replace_id, | 12 const string16& replace_id, |
| 13 NotificationDelegate* delegate) | 13 NotificationDelegate* delegate) |
| 14 : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE), | 14 : type_(message_center::NOTIFICATION_TYPE_SIMPLE), |
| 15 origin_url_(origin_url), | 15 origin_url_(origin_url), |
| 16 is_html_(true), | 16 is_html_(true), |
| 17 content_url_(content_url), | 17 content_url_(content_url), |
| 18 display_source_(display_source), | 18 display_source_(display_source), |
| 19 replace_id_(replace_id), | 19 replace_id_(replace_id), |
| 20 delegate_(delegate) { | 20 delegate_(delegate) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 Notification::Notification(const GURL& origin_url, | 23 Notification::Notification(const GURL& origin_url, |
| 24 const GURL& icon_url, | 24 const GURL& icon_url, |
| 25 const string16& title, | 25 const string16& title, |
| 26 const string16& body, | 26 const string16& body, |
| 27 WebKit::WebTextDirection dir, | 27 WebKit::WebTextDirection dir, |
| 28 const string16& display_source, | 28 const string16& display_source, |
| 29 const string16& replace_id, | 29 const string16& replace_id, |
| 30 NotificationDelegate* delegate) | 30 NotificationDelegate* delegate) |
| 31 : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE), | 31 : type_(message_center::NOTIFICATION_TYPE_SIMPLE), |
| 32 origin_url_(origin_url), | 32 origin_url_(origin_url), |
| 33 icon_url_(icon_url), | 33 icon_url_(icon_url), |
| 34 is_html_(false), | 34 is_html_(false), |
| 35 title_(title), | 35 title_(title), |
| 36 body_(body), | 36 body_(body), |
| 37 display_source_(display_source), | 37 display_source_(display_source), |
| 38 replace_id_(replace_id), | 38 replace_id_(replace_id), |
| 39 delegate_(delegate) { | 39 delegate_(delegate) { |
| 40 // "Upconvert" the string parameters to a data: URL. | 40 // "Upconvert" the string parameters to a data: URL. |
| 41 content_url_ = GURL(DesktopNotificationService::CreateDataUrl( | 41 content_url_ = GURL(DesktopNotificationService::CreateDataUrl( |
| 42 icon_url, title, body, dir)); | 42 icon_url, title, body, dir)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 Notification::Notification(ui::notifications::NotificationType type, | 45 Notification::Notification(message_center::NotificationType type, |
| 46 const GURL& origin_url, | 46 const GURL& origin_url, |
| 47 const GURL& icon_url, | 47 const GURL& icon_url, |
| 48 const string16& title, | 48 const string16& title, |
| 49 const string16& body, | 49 const string16& body, |
| 50 WebKit::WebTextDirection dir, | 50 WebKit::WebTextDirection dir, |
| 51 const string16& display_source, | 51 const string16& display_source, |
| 52 const string16& replace_id, | 52 const string16& replace_id, |
| 53 const DictionaryValue* optional_fields, | 53 const DictionaryValue* optional_fields, |
| 54 NotificationDelegate* delegate) | 54 NotificationDelegate* delegate) |
| 55 : type_(type), | 55 : type_(type), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 Notification::Notification(const GURL& origin_url, | 73 Notification::Notification(const GURL& origin_url, |
| 74 const gfx::ImageSkia& icon, | 74 const gfx::ImageSkia& icon, |
| 75 const string16& title, | 75 const string16& title, |
| 76 const string16& body, | 76 const string16& body, |
| 77 WebKit::WebTextDirection dir, | 77 WebKit::WebTextDirection dir, |
| 78 const string16& display_source, | 78 const string16& display_source, |
| 79 const string16& replace_id, | 79 const string16& replace_id, |
| 80 NotificationDelegate* delegate) | 80 NotificationDelegate* delegate) |
| 81 : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE), | 81 : type_(message_center::NOTIFICATION_TYPE_SIMPLE), |
| 82 origin_url_(origin_url), | 82 origin_url_(origin_url), |
| 83 icon_(icon), | 83 icon_(icon), |
| 84 is_html_(false), | 84 is_html_(false), |
| 85 title_(title), | 85 title_(title), |
| 86 body_(body), | 86 body_(body), |
| 87 display_source_(display_source), | 87 display_source_(display_source), |
| 88 replace_id_(replace_id), | 88 replace_id_(replace_id), |
| 89 delegate_(delegate) { | 89 delegate_(delegate) { |
| 90 } | 90 } |
| 91 | 91 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 body_ = notification.body(); | 118 body_ = notification.body(); |
| 119 display_source_ = notification.display_source(); | 119 display_source_ = notification.display_source(); |
| 120 replace_id_ = notification.replace_id(); | 120 replace_id_ = notification.replace_id(); |
| 121 if (notification.optional_fields()) | 121 if (notification.optional_fields()) |
| 122 optional_fields_.reset(notification.optional_fields()->DeepCopy()); | 122 optional_fields_.reset(notification.optional_fields()->DeepCopy()); |
| 123 else | 123 else |
| 124 optional_fields_.reset(); | 124 optional_fields_.reset(); |
| 125 delegate_ = notification.delegate(); | 125 delegate_ = notification.delegate(); |
| 126 return *this; | 126 return *this; |
| 127 } | 127 } |
| OLD | NEW |