| 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/sync_notifier/synced_notification.h" | 5 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 gfx::Image icon_bitmap = app_icon_bitmap_; | 291 gfx::Image icon_bitmap = app_icon_bitmap_; |
| 292 if (GetProfilePictureCount() >= 1) { | 292 if (GetProfilePictureCount() >= 1) { |
| 293 icon_bitmap = sender_bitmap_; | 293 icon_bitmap = sender_bitmap_; |
| 294 } | 294 } |
| 295 | 295 |
| 296 Notification ui_notification(notification_type, | 296 Notification ui_notification(notification_type, |
| 297 GetOriginUrl(), | 297 GetOriginUrl(), |
| 298 notification_heading, | 298 notification_heading, |
| 299 notification_text, | 299 notification_text, |
| 300 icon_bitmap, | 300 icon_bitmap, |
| 301 WebKit::WebTextDirectionDefault, | 301 blink::WebTextDirectionDefault, |
| 302 message_center::NotifierId(GetOriginUrl()), | 302 message_center::NotifierId(GetOriginUrl()), |
| 303 display_source, | 303 display_source, |
| 304 replace_key, | 304 replace_key, |
| 305 rich_notification_data, | 305 rich_notification_data, |
| 306 delegate.get()); | 306 delegate.get()); |
| 307 | 307 |
| 308 // In case the notification is not supposed to be toasted, pretend that it | 308 // In case the notification is not supposed to be toasted, pretend that it |
| 309 // has already been shown. | 309 // has already been shown. |
| 310 ui_notification.set_shown_as_popup(!toast_state_); | 310 ui_notification.set_shown_as_popup(!toast_state_); |
| 311 | 311 |
| 312 notification_manager->Add(ui_notification, profile); | 312 notification_manager->Add(ui_notification, profile); |
| 313 } else { | 313 } else { |
| 314 // In this case we have a Webkit Notification, not a Rich Notification. | 314 // In this case we have a Webkit Notification, not a Rich Notification. |
| 315 Notification ui_notification(GetOriginUrl(), | 315 Notification ui_notification(GetOriginUrl(), |
| 316 GetAppIconUrl(), | 316 GetAppIconUrl(), |
| 317 notification_heading, | 317 notification_heading, |
| 318 notification_text, | 318 notification_text, |
| 319 WebKit::WebTextDirectionDefault, | 319 blink::WebTextDirectionDefault, |
| 320 display_source, | 320 display_source, |
| 321 replace_key, | 321 replace_key, |
| 322 delegate.get()); | 322 delegate.get()); |
| 323 | 323 |
| 324 notification_manager->Add(ui_notification, profile); | 324 notification_manager->Add(ui_notification, profile); |
| 325 } | 325 } |
| 326 | 326 |
| 327 DVLOG(1) << "Showing Synced Notification! " << heading << " " << text | 327 DVLOG(1) << "Showing Synced Notification! " << heading << " " << text |
| 328 << " " << GetAppIconUrl() << " " << replace_key << " " | 328 << " " << GetAppIconUrl() << " " << replace_key << " " |
| 329 << GetProfilePictureUrl(0) << " " << GetReadState(); | 329 << GetProfilePictureUrl(0) << " " << GetReadState(); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 // hardcoded to the name of our first service using synced notifications. | 697 // hardcoded to the name of our first service using synced notifications. |
| 698 // Once the new protocol is built, remove this hardcoding. | 698 // Once the new protocol is built, remove this hardcoding. |
| 699 return kFirstSyncedNotificationServiceId; | 699 return kFirstSyncedNotificationServiceId; |
| 700 } | 700 } |
| 701 | 701 |
| 702 void SyncedNotification::SetToastState(bool toast_state) { | 702 void SyncedNotification::SetToastState(bool toast_state) { |
| 703 toast_state_ = toast_state; | 703 toast_state_ = toast_state; |
| 704 } | 704 } |
| 705 | 705 |
| 706 } // namespace notifier | 706 } // namespace notifier |
| OLD | NEW |