| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 class BrowserContext; | 30 class BrowserContext; |
| 31 struct NotificationResources; | 31 struct NotificationResources; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace gcm { | 34 namespace gcm { |
| 35 class PushMessagingBrowserTest; | 35 class PushMessagingBrowserTest; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace user_prefs { |
| 39 class PrefRegistrySyncable; |
| 40 } |
| 41 |
| 38 // The platform notification service is the profile-agnostic entry point through | 42 // The platform notification service is the profile-agnostic entry point through |
| 39 // which Web Notifications can be controlled. | 43 // which Web Notifications can be controlled. |
| 40 class PlatformNotificationServiceImpl | 44 class PlatformNotificationServiceImpl |
| 41 : public content::PlatformNotificationService { | 45 : public content::PlatformNotificationService { |
| 42 public: | 46 public: |
| 43 // Things you can do to a notification. | 47 // Things you can do to a notification. |
| 44 enum NotificationOperation { | 48 enum NotificationOperation { |
| 45 NOTIFICATION_CLICK, | 49 NOTIFICATION_CLICK, |
| 46 NOTIFICATION_CLOSE, | 50 NOTIFICATION_CLOSE, |
| 47 NOTIFICATION_SETTINGS | 51 NOTIFICATION_SETTINGS |
| 48 }; | 52 }; |
| 49 | 53 |
| 54 // Register profile-specific prefs. |
| 55 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 56 |
| 50 // Returns the active instance of the service in the browser process. Safe to | 57 // Returns the active instance of the service in the browser process. Safe to |
| 51 // be called from any thread. | 58 // be called from any thread. |
| 52 static PlatformNotificationServiceImpl* GetInstance(); | 59 static PlatformNotificationServiceImpl* GetInstance(); |
| 53 | 60 |
| 54 // Load the profile corresponding to |profile_id| and perform the | 61 // Load the profile corresponding to |profile_id| and perform the |
| 55 // |operation| on the given notification once it has been loaded. | 62 // |operation| on the given notification once it has been loaded. |
| 56 void ProcessPersistentNotificationOperation( | 63 void ProcessPersistentNotificationOperation( |
| 57 NotificationOperation operation, | 64 NotificationOperation operation, |
| 58 const std::string& profile_id, | 65 const std::string& profile_id, |
| 59 bool incognito, | 66 bool incognito, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // programmatically to avoid dispatching close events for them. | 163 // programmatically to avoid dispatching close events for them. |
| 157 std::unordered_set<int64_t> closed_notifications_; | 164 std::unordered_set<int64_t> closed_notifications_; |
| 158 | 165 |
| 159 // Only set and used for tests, owned by the caller in that case. | 166 // Only set and used for tests, owned by the caller in that case. |
| 160 NotificationDisplayService* test_display_service_; | 167 NotificationDisplayService* test_display_service_; |
| 161 | 168 |
| 162 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 169 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
| 163 }; | 170 }; |
| 164 | 171 |
| 165 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 172 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| OLD | NEW |