| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // script is in a worker or page. |notification_id| is an opaque | 45 // script is in a worker or page. |notification_id| is an opaque |
| 46 // value to be passed back to the process when events occur on | 46 // value to be passed back to the process when events occur on |
| 47 // this notification. | 47 // this notification. |
| 48 bool ShowDesktopNotification(const GURL& origin, const GURL& url, | 48 bool ShowDesktopNotification(const GURL& origin, const GURL& url, |
| 49 int process_id, int route_id, NotificationSource source, | 49 int process_id, int route_id, NotificationSource source, |
| 50 int notification_id); | 50 int notification_id); |
| 51 bool ShowDesktopNotificationText(const GURL& origin, const GURL& icon, | 51 bool ShowDesktopNotificationText(const GURL& origin, const GURL& icon, |
| 52 const string16& title, const string16& text, int process_id, | 52 const string16& title, const string16& text, int process_id, |
| 53 int route_id, NotificationSource source, int notification_id); | 53 int route_id, NotificationSource source, int notification_id); |
| 54 | 54 |
| 55 // Cancels a notification. If it has already been shown, it will be |
| 56 // removed from the screen. If it hasn't been shown yet, it won't be |
| 57 // shown. |
| 58 bool CancelDesktopNotification(int process_id, |
| 59 int route_id, |
| 60 int notification_id); |
| 61 |
| 55 // Methods to setup and modify permission preferences. | 62 // Methods to setup and modify permission preferences. |
| 56 void GrantPermission(const GURL& origin); | 63 void GrantPermission(const GURL& origin); |
| 57 void DenyPermission(const GURL& origin); | 64 void DenyPermission(const GURL& origin); |
| 58 | 65 |
| 59 NotificationsPrefsCache* prefs_cache() { return prefs_cache_; } | 66 NotificationsPrefsCache* prefs_cache() { return prefs_cache_; } |
| 60 | 67 |
| 61 private: | 68 private: |
| 62 void InitPrefs(); | 69 void InitPrefs(); |
| 63 | 70 |
| 64 // The profile which owns this object. | 71 // The profile which owns this object. |
| 65 Profile* profile_; | 72 Profile* profile_; |
| 66 | 73 |
| 67 // A cache of preferences which is accessible only on the IO thread | 74 // A cache of preferences which is accessible only on the IO thread |
| 68 // to service synchronous IPCs. | 75 // to service synchronous IPCs. |
| 69 scoped_refptr<NotificationsPrefsCache> prefs_cache_; | 76 scoped_refptr<NotificationsPrefsCache> prefs_cache_; |
| 70 | 77 |
| 71 // Non-owned pointer to the notification manager which manages the | 78 // Non-owned pointer to the notification manager which manages the |
| 72 // UI for desktop toasts. | 79 // UI for desktop toasts. |
| 73 NotificationUIManager* ui_manager_; | 80 NotificationUIManager* ui_manager_; |
| 74 | 81 |
| 75 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 82 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 85 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |