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/desktop_notification_service.h" | 5 #include "chrome/browser/notifications/desktop_notification_service.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 string16 display_source = DisplayNameForOriginInProcessId(origin, process_id); | 506 string16 display_source = DisplayNameForOriginInProcessId(origin, process_id); |
507 if (params.is_html) { | 507 if (params.is_html) { |
508 ShowNotification(Notification(origin, params.contents_url, display_source, | 508 ShowNotification(Notification(origin, params.contents_url, display_source, |
509 params.replace_id, proxy)); | 509 params.replace_id, proxy)); |
510 } else { | 510 } else { |
511 Notification notification(origin, params.icon_url, params.title, | 511 Notification notification(origin, params.icon_url, params.title, |
512 params.body, params.direction, display_source, params.replace_id, | 512 params.body, params.direction, display_source, params.replace_id, |
513 proxy); | 513 proxy); |
514 // The webkit notification doesn't timeout. | 514 // The webkit notification doesn't timeout. |
515 notification.DisableTimeout(); | 515 notification.set_never_timeout(true); |
516 ShowNotification(notification); | 516 ShowNotification(notification); |
517 } | 517 } |
518 return true; | 518 return true; |
519 } | 519 } |
520 | 520 |
521 string16 DesktopNotificationService::DisplayNameForOriginInProcessId( | 521 string16 DesktopNotificationService::DisplayNameForOriginInProcessId( |
522 const GURL& origin, int process_id) { | 522 const GURL& origin, int process_id) { |
523 // If the source is an extension, lookup the display name. | 523 // If the source is an extension, lookup the display name. |
524 // Message center prefers to use extension name if the notification | 524 // Message center prefers to use extension name if the notification |
525 // is allowed by an extension. | 525 // is allowed by an extension. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 const content::NotificationDetails& details) { | 629 const content::NotificationDetails& details) { |
630 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNINSTALLED, type); | 630 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNINSTALLED, type); |
631 | 631 |
632 extensions::Extension* extension = | 632 extensions::Extension* extension = |
633 content::Details<extensions::Extension>(details).ptr(); | 633 content::Details<extensions::Extension>(details).ptr(); |
634 if (IsExtensionEnabled(extension->id())) | 634 if (IsExtensionEnabled(extension->id())) |
635 return; | 635 return; |
636 | 636 |
637 SetExtensionEnabled(extension->id(), true); | 637 SetExtensionEnabled(extension->id(), true); |
638 } | 638 } |
OLD | NEW |