| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/notification.h" | 5 #include "ui/message_center/notification.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/message_center/notification_delegate.h" |
| 8 #include "ui/message_center/notification_types.h" | 9 #include "ui/message_center/notification_types.h" |
| 9 | 10 |
| 10 namespace { | 11 namespace { |
| 11 unsigned g_next_serial_number_ = 0; | 12 unsigned g_next_serial_number_ = 0; |
| 12 } | 13 } |
| 13 | 14 |
| 14 namespace message_center { | 15 namespace message_center { |
| 15 | 16 |
| 16 NotificationItem::NotificationItem(const string16& title, | 17 NotificationItem::NotificationItem(const string16& title, |
| 17 const string16& message) | 18 const string16& message) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (index >= optional_fields_.buttons.size()) | 113 if (index >= optional_fields_.buttons.size()) |
| 113 return; | 114 return; |
| 114 optional_fields_.buttons[index].icon = icon; | 115 optional_fields_.buttons[index].icon = icon; |
| 115 } | 116 } |
| 116 | 117 |
| 117 void Notification::SetSystemPriority() { | 118 void Notification::SetSystemPriority() { |
| 118 optional_fields_.priority = SYSTEM_PRIORITY; | 119 optional_fields_.priority = SYSTEM_PRIORITY; |
| 119 optional_fields_.never_timeout = true; | 120 optional_fields_.never_timeout = true; |
| 120 } | 121 } |
| 121 | 122 |
| 123 // static |
| 124 scoped_ptr<Notification> Notification::CreateSystemNotification( |
| 125 const std::string& notification_id, |
| 126 const base::string16& title, |
| 127 const base::string16& message, |
| 128 const gfx::Image& icon, |
| 129 const base::Closure& click_callback) { |
| 130 scoped_ptr<Notification> notification( |
| 131 new Notification( |
| 132 NOTIFICATION_TYPE_SIMPLE, |
| 133 notification_id, |
| 134 title, |
| 135 message, |
| 136 icon, |
| 137 base::string16() /* display_source */, |
| 138 std::string() /* extension_id */, |
| 139 RichNotificationData(), |
| 140 new HandleNotificationClickedDelegate(click_callback))); |
| 141 notification->SetSystemPriority(); |
| 142 return notification.Pass(); |
| 143 } |
| 144 |
| 122 } // namespace message_center | 145 } // namespace message_center |
| OLD | NEW |