| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 // Returns the notification display service to use. | 138 // Returns the notification display service to use. |
| 139 // This can be overriden in tests. | 139 // This can be overriden in tests. |
| 140 // TODO(miguelg): Remove this method in favor of providing a testing factory | 140 // TODO(miguelg): Remove this method in favor of providing a testing factory |
| 141 // to the NotificationDisplayServiceFactory. | 141 // to the NotificationDisplayServiceFactory. |
| 142 NotificationDisplayService* GetNotificationDisplayService(Profile* profile); | 142 NotificationDisplayService* GetNotificationDisplayService(Profile* profile); |
| 143 | 143 |
| 144 void SetNotificationDisplayServiceForTesting( | 144 void SetNotificationDisplayServiceForTesting( |
| 145 NotificationDisplayService* service); | 145 NotificationDisplayService* service); |
| 146 | 146 |
| 147 void RecordSiteEngagement(content::BrowserContext* browser_context, |
| 148 const GURL& origin); |
| 149 |
| 147 #if BUILDFLAG(ENABLE_BACKGROUND) | 150 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 148 // Makes sure we keep the browser alive while the event in being processed. | 151 // Makes sure we keep the browser alive while the event in being processed. |
| 149 // As we have no control on the click handling, the notification could be | 152 // As we have no control on the click handling, the notification could be |
| 150 // closed before a browser is brought up, thus terminating Chrome if it was | 153 // closed before a browser is brought up, thus terminating Chrome if it was |
| 151 // the last KeepAlive. (see https://crbug.com/612815) | 154 // the last KeepAlive. (see https://crbug.com/612815) |
| 152 std::unique_ptr<ScopedKeepAlive> click_dispatch_keep_alive_; | 155 std::unique_ptr<ScopedKeepAlive> click_dispatch_keep_alive_; |
| 153 | 156 |
| 154 int pending_click_dispatch_events_; | 157 int pending_click_dispatch_events_; |
| 155 #endif | 158 #endif |
| 156 | 159 |
| 157 // Tracks the id of persistent notifications that have been closed | 160 // Tracks the id of persistent notifications that have been closed |
| 158 // programmatically to avoid dispatching close events for them. | 161 // programmatically to avoid dispatching close events for them. |
| 159 std::unordered_set<std::string> closed_notifications_; | 162 std::unordered_set<std::string> closed_notifications_; |
| 160 | 163 |
| 161 // Only set and used for tests, owned by the caller in that case. | 164 // Only set and used for tests, owned by the caller in that case. |
| 162 NotificationDisplayService* test_display_service_; | 165 NotificationDisplayService* test_display_service_; |
| 163 | 166 |
| 164 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 167 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 170 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| OLD | NEW |