| 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_delegate.h" |
| 9 #include "ui/message_center/notification_types.h" | 9 #include "ui/message_center/notification_types.h" |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 optional_fields_.priority = SYSTEM_PRIORITY; | 162 optional_fields_.priority = SYSTEM_PRIORITY; |
| 163 optional_fields_.never_timeout = true; | 163 optional_fields_.never_timeout = true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool Notification::UseOriginAsContextMessage() const { | 166 bool Notification::UseOriginAsContextMessage() const { |
| 167 return optional_fields_.context_message.empty() && origin_url_.is_valid() && | 167 return optional_fields_.context_message.empty() && origin_url_.is_valid() && |
| 168 origin_url_.SchemeIsHTTPOrHTTPS(); | 168 origin_url_.SchemeIsHTTPOrHTTPS(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // static | 171 // static |
| 172 scoped_ptr<Notification> Notification::CreateSystemNotification( | 172 std::unique_ptr<Notification> Notification::CreateSystemNotification( |
| 173 const std::string& notification_id, | 173 const std::string& notification_id, |
| 174 const base::string16& title, | 174 const base::string16& title, |
| 175 const base::string16& message, | 175 const base::string16& message, |
| 176 const gfx::Image& icon, | 176 const gfx::Image& icon, |
| 177 const std::string& system_component_id, | 177 const std::string& system_component_id, |
| 178 const base::Closure& click_callback) { | 178 const base::Closure& click_callback) { |
| 179 scoped_ptr<Notification> notification(new Notification( | 179 std::unique_ptr<Notification> notification(new Notification( |
| 180 NOTIFICATION_TYPE_SIMPLE, notification_id, title, message, icon, | 180 NOTIFICATION_TYPE_SIMPLE, notification_id, title, message, icon, |
| 181 base::string16() /* display_source */, GURL(), | 181 base::string16() /* display_source */, GURL(), |
| 182 NotifierId(NotifierId::SYSTEM_COMPONENT, system_component_id), | 182 NotifierId(NotifierId::SYSTEM_COMPONENT, system_component_id), |
| 183 RichNotificationData(), | 183 RichNotificationData(), |
| 184 new HandleNotificationClickedDelegate(click_callback))); | 184 new HandleNotificationClickedDelegate(click_callback))); |
| 185 notification->SetSystemPriority(); | 185 notification->SetSystemPriority(); |
| 186 return notification; | 186 return notification; |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace message_center | 189 } // namespace message_center |
| OLD | NEW |