| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/features.h" | 23 #include "chrome/common/features.h" |
| 24 #include "content/public/browser/platform_notification_service.h" | 24 #include "content/public/browser/platform_notification_service.h" |
| 25 #include "content/public/common/persistent_notification_status.h" | 25 #include "content/public/common/persistent_notification_status.h" |
| 26 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" | 26 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
| 27 | 27 |
| 28 class NotificationDelegate; | 28 class NotificationDelegate; |
| 29 class NotificationDisplayService; | 29 class NotificationDisplayService; |
| 30 class ScopedKeepAlive; | 30 class ScopedKeepAlive; |
| 31 | 31 |
| 32 namespace base { |
| 33 class NullableString16; |
| 34 } |
| 35 |
| 32 namespace content { | 36 namespace content { |
| 33 class BrowserContext; | 37 class BrowserContext; |
| 34 struct NotificationResources; | 38 struct NotificationResources; |
| 35 } | 39 } |
| 36 | 40 |
| 37 namespace gcm { | 41 namespace gcm { |
| 38 class PushMessagingBrowserTest; | 42 class PushMessagingBrowserTest; |
| 39 } | 43 } |
| 40 | 44 |
| 41 // The platform notification service is the profile-agnostic entry point through | 45 // The platform notification service is the profile-agnostic entry point through |
| 42 // which Web Notifications can be controlled. | 46 // which Web Notifications can be controlled. |
| 43 class PlatformNotificationServiceImpl | 47 class PlatformNotificationServiceImpl |
| 44 : public content::PlatformNotificationService { | 48 : public content::PlatformNotificationService { |
| 45 public: | 49 public: |
| 46 // Returns the active instance of the service in the browser process. Safe to | 50 // Returns the active instance of the service in the browser process. Safe to |
| 47 // be called from any thread. | 51 // be called from any thread. |
| 48 static PlatformNotificationServiceImpl* GetInstance(); | 52 static PlatformNotificationServiceImpl* GetInstance(); |
| 49 | 53 |
| 50 // To be called when a persistent notification has been clicked on. The | 54 // To be called when a persistent notification has been clicked on. The |
| 51 // Service Worker associated with the registration will be started if | 55 // Service Worker associated with the registration will be started if |
| 52 // needed, on which the event will be fired. Must be called on the UI thread. | 56 // needed, on which the event will be fired. Must be called on the UI thread. |
| 53 void OnPersistentNotificationClick(content::BrowserContext* browser_context, | 57 void OnPersistentNotificationClick(content::BrowserContext* browser_context, |
| 54 const std::string& notification_id, | 58 const std::string& notification_id, |
| 55 const GURL& origin, | 59 const GURL& origin, |
| 56 int action_index); | 60 int action_index, |
| 61 const base::NullableString16& reply); |
| 57 | 62 |
| 58 // To be called when a persistent notification has been closed. The data | 63 // To be called when a persistent notification has been closed. The data |
| 59 // associated with the notification has to be pruned from the database in this | 64 // associated with the notification has to be pruned from the database in this |
| 60 // case, to make sure that it continues to be in sync. Must be called on the | 65 // case, to make sure that it continues to be in sync. Must be called on the |
| 61 // UI thread. | 66 // UI thread. |
| 62 void OnPersistentNotificationClose(content::BrowserContext* browser_context, | 67 void OnPersistentNotificationClose(content::BrowserContext* browser_context, |
| 63 const std::string& notification_id, | 68 const std::string& notification_id, |
| 64 const GURL& origin, | 69 const GURL& origin, |
| 65 bool by_user); | 70 bool by_user); |
| 66 | 71 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // programmatically to avoid dispatching close events for them. | 157 // programmatically to avoid dispatching close events for them. |
| 153 std::unordered_set<std::string> closed_notifications_; | 158 std::unordered_set<std::string> closed_notifications_; |
| 154 | 159 |
| 155 // Only set and used for tests, owned by the caller in that case. | 160 // Only set and used for tests, owned by the caller in that case. |
| 156 NotificationDisplayService* test_display_service_; | 161 NotificationDisplayService* test_display_service_; |
| 157 | 162 |
| 158 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 163 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
| 159 }; | 164 }; |
| 160 | 165 |
| 161 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 166 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| OLD | NEW |