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/message_center_notification_manager.h" | 5 #include "chrome/browser/notifications/message_center_notification_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ¬ification.icon(), | 241 ¬ification.icon(), |
242 notification.icon_url(), | 242 notification.icon_url(), |
243 message_center::kNotificationIconSize, | 243 message_center::kNotificationIconSize, |
244 base::Bind(&message_center::MessageCenter::SetNotificationIcon, | 244 base::Bind(&message_center::MessageCenter::SetNotificationIcon, |
245 base::Unretained(message_center_), | 245 base::Unretained(message_center_), |
246 notification.notification_id())); | 246 notification.notification_id())); |
247 | 247 |
248 // Notification image. | 248 // Notification image. |
249 StartDownloadByKey( | 249 StartDownloadByKey( |
250 notification, | 250 notification, |
251 ui::notifications::kImageUrlKey, | 251 message_center::kImageUrlKey, |
252 message_center::kNotificationPreferredImageSize, | 252 message_center::kNotificationPreferredImageSize, |
253 base::Bind(&message_center::MessageCenter::SetNotificationImage, | 253 base::Bind(&message_center::MessageCenter::SetNotificationImage, |
254 base::Unretained(message_center_), | 254 base::Unretained(message_center_), |
255 notification.notification_id())); | 255 notification.notification_id())); |
256 | 256 |
257 // Notification button icons. | 257 // Notification button icons. |
258 StartDownloadByKey( | 258 StartDownloadByKey( |
259 notification, | 259 notification, |
260 ui::notifications::kButtonOneIconUrlKey, | 260 message_center::kButtonOneIconUrlKey, |
261 message_center::kNotificationButtonIconSize, | 261 message_center::kNotificationButtonIconSize, |
262 base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon, | 262 base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon, |
263 base::Unretained(message_center_), | 263 base::Unretained(message_center_), |
264 notification.notification_id(), 0)); | 264 notification.notification_id(), 0)); |
265 StartDownloadByKey( | 265 StartDownloadByKey( |
266 notification, ui::notifications::kButtonTwoIconUrlKey, | 266 notification, message_center::kButtonTwoIconUrlKey, |
267 message_center::kNotificationButtonIconSize, | 267 message_center::kNotificationButtonIconSize, |
268 base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon, | 268 base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon, |
269 base::Unretained(message_center_), | 269 base::Unretained(message_center_), |
270 notification.notification_id(), 1)); | 270 notification.notification_id(), 1)); |
271 } | 271 } |
272 | 272 |
273 void MessageCenterNotificationManager::ImageDownloads::StartDownloadWithImage( | 273 void MessageCenterNotificationManager::ImageDownloads::StartDownloadWithImage( |
274 const Notification& notification, | 274 const Notification& notification, |
275 const gfx::ImageSkia* image, | 275 const gfx::ImageSkia* image, |
276 const GURL& url, | 276 const GURL& url, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 MessageCenterNotificationManager::ProfileNotification* | 396 MessageCenterNotificationManager::ProfileNotification* |
397 MessageCenterNotificationManager::FindProfileNotification( | 397 MessageCenterNotificationManager::FindProfileNotification( |
398 const std::string& id) const { | 398 const std::string& id) const { |
399 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 399 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
400 // If the notification is shown in UI, it must be in the map. | 400 // If the notification is shown in UI, it must be in the map. |
401 DCHECK(iter != profile_notifications_.end()); | 401 DCHECK(iter != profile_notifications_.end()); |
402 DCHECK((*iter).second); | 402 DCHECK((*iter).second); |
403 return (*iter).second; | 403 return (*iter).second; |
404 } | 404 } |
OLD | NEW |