| 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 #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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 enum DesktopNotificationSource { | 40 enum DesktopNotificationSource { |
| 41 PageNotification, | 41 PageNotification, |
| 42 WorkerNotification | 42 WorkerNotification |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 DesktopNotificationService(Profile* profile, | 45 DesktopNotificationService(Profile* profile, |
| 46 NotificationUIManager* ui_manager); | 46 NotificationUIManager* ui_manager); |
| 47 virtual ~DesktopNotificationService(); | 47 virtual ~DesktopNotificationService(); |
| 48 | 48 |
| 49 // Sets a UI manager to display notifications. | |
| 50 void SetUIManager(NotificationUIManager* ui_manager); | |
| 51 | |
| 52 // Requests permission (using an info-bar) for a given origin. | 49 // Requests permission (using an info-bar) for a given origin. |
| 53 // |callback_context| contains an opaque value to pass back to the | 50 // |callback_context| contains an opaque value to pass back to the |
| 54 // requesting process when the info-bar finishes. A NULL tab can be given if | 51 // requesting process when the info-bar finishes. A NULL tab can be given if |
| 55 // none exist (i.e. background tab), in which case the currently selected tab | 52 // none exist (i.e. background tab), in which case the currently selected tab |
| 56 // will be used. | 53 // will be used. |
| 57 void RequestPermission(const GURL& origin, | 54 void RequestPermission(const GURL& origin, |
| 58 int process_id, | 55 int process_id, |
| 59 int route_id, | 56 int route_id, |
| 60 int callback_context, | 57 int callback_context, |
| 61 TabContents* tab); | 58 TabContents* tab); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void ShowNotification(const Notification& notification); | 129 void ShowNotification(const Notification& notification); |
| 133 | 130 |
| 134 // Returns a display name for an origin, to be used in permission infobar | 131 // Returns a display name for an origin, to be used in permission infobar |
| 135 // or on the frame of the notification toast. Different from the origin | 132 // or on the frame of the notification toast. Different from the origin |
| 136 // itself when dealing with extensions. | 133 // itself when dealing with extensions. |
| 137 string16 DisplayNameForOrigin(const GURL& origin); | 134 string16 DisplayNameForOrigin(const GURL& origin); |
| 138 | 135 |
| 139 // Notifies the observers when permissions settings change. | 136 // Notifies the observers when permissions settings change. |
| 140 void NotifySettingsChange(); | 137 void NotifySettingsChange(); |
| 141 | 138 |
| 139 NotificationUIManager* GetUIManager(); |
| 140 |
| 142 // The profile which owns this object. | 141 // The profile which owns this object. |
| 143 Profile* profile_; | 142 Profile* profile_; |
| 144 | 143 |
| 145 // Non-owned pointer to the notification manager which manages the | 144 // Non-owned pointer to the notification manager which manages the |
| 146 // UI for desktop toasts. | 145 // UI for desktop toasts. |
| 147 NotificationUIManager* ui_manager_; | 146 NotificationUIManager* ui_manager_; |
| 148 | 147 |
| 149 content::NotificationRegistrar notification_registrar_; | 148 content::NotificationRegistrar notification_registrar_; |
| 150 | 149 |
| 151 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 150 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
| 152 }; | 151 }; |
| 153 | 152 |
| 154 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 153 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |