OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/content_settings_provider.h" | 10 #include "chrome/browser/content_settings/content_settings_provider.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 } | 584 } |
585 return UTF8ToUTF16(origin.host()); | 585 return UTF8ToUTF16(origin.host()); |
586 } | 586 } |
587 | 587 |
588 void DesktopNotificationService::NotifySettingsChange() { | 588 void DesktopNotificationService::NotifySettingsChange() { |
589 NotificationService::current()->Notify( | 589 NotificationService::current()->Notify( |
590 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, | 590 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, |
591 Source<DesktopNotificationService>(this), | 591 Source<DesktopNotificationService>(this), |
592 NotificationService::NoDetails()); | 592 NotificationService::NoDetails()); |
593 } | 593 } |
| 594 |
| 595 void DesktopNotificationService::ShowBalloon(GURL origin_url, |
| 596 GURL icon_url, |
| 597 const string16& title, |
| 598 const string16& message, |
| 599 NotificationDelegate* delegate, |
| 600 Profile* profile) { |
| 601 string16 content_url = CreateDataUrl(icon_url, title, message, |
| 602 WebKit::WebTextDirectionDefault); |
| 603 Notification notification(origin_url, GURL(content_url), string16(), |
| 604 string16(), delegate); |
| 605 g_browser_process->notification_ui_manager()->Add(notification, profile); |
| 606 } |
| 607 |
| 608 int DesktopNotificationService::HasPermission(Profile* profile, |
| 609 const GURL& origin) { |
| 610 return DesktopNotificationServiceFactory::GetForProfile(profile)-> |
| 611 prefs_cache()->HasPermission(origin.GetOrigin()); |
| 612 } |
OLD | NEW |