| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <unordered_set> | 14 #include <unordered_set> |
| 15 | 15 |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
| 19 #include "base/strings/nullable_string16.h" |
| 19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 20 #include "chrome/browser/notifications/notification.h" | 21 #include "chrome/browser/notifications/notification.h" |
| 21 #include "chrome/browser/notifications/notification_common.h" | 22 #include "chrome/browser/notifications/notification_common.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/features.h" | 24 #include "chrome/common/features.h" |
| 24 #include "content/public/browser/platform_notification_service.h" | 25 #include "content/public/browser/platform_notification_service.h" |
| 25 #include "content/public/common/persistent_notification_status.h" | 26 #include "content/public/common/persistent_notification_status.h" |
| 26 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" | 27 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
| 27 | 28 |
| 28 class NotificationDelegate; | 29 class NotificationDelegate; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 // Returns the active instance of the service in the browser process. Safe to | 47 // Returns the active instance of the service in the browser process. Safe to |
| 47 // be called from any thread. | 48 // be called from any thread. |
| 48 static PlatformNotificationServiceImpl* GetInstance(); | 49 static PlatformNotificationServiceImpl* GetInstance(); |
| 49 | 50 |
| 50 // To be called when a persistent notification has been clicked on. The | 51 // To be called when a persistent notification has been clicked on. The |
| 51 // Service Worker associated with the registration will be started if | 52 // 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. | 53 // needed, on which the event will be fired. Must be called on the UI thread. |
| 53 void OnPersistentNotificationClick(content::BrowserContext* browser_context, | 54 void OnPersistentNotificationClick(content::BrowserContext* browser_context, |
| 54 const std::string& notification_id, | 55 const std::string& notification_id, |
| 55 const GURL& origin, | 56 const GURL& origin, |
| 56 int action_index); | 57 int action_index, |
| 58 const base::NullableString16& reply); |
| 57 | 59 |
| 58 // To be called when a persistent notification has been closed. The data | 60 // 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 | 61 // 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 | 62 // case, to make sure that it continues to be in sync. Must be called on the |
| 61 // UI thread. | 63 // UI thread. |
| 62 void OnPersistentNotificationClose(content::BrowserContext* browser_context, | 64 void OnPersistentNotificationClose(content::BrowserContext* browser_context, |
| 63 const std::string& notification_id, | 65 const std::string& notification_id, |
| 64 const GURL& origin, | 66 const GURL& origin, |
| 65 bool by_user); | 67 bool by_user); |
| 66 | 68 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // programmatically to avoid dispatching close events for them. | 154 // programmatically to avoid dispatching close events for them. |
| 153 std::unordered_set<std::string> closed_notifications_; | 155 std::unordered_set<std::string> closed_notifications_; |
| 154 | 156 |
| 155 // Only set and used for tests, owned by the caller in that case. | 157 // Only set and used for tests, owned by the caller in that case. |
| 156 NotificationDisplayService* test_display_service_; | 158 NotificationDisplayService* test_display_service_; |
| 157 | 159 |
| 158 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 160 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
| 159 }; | 161 }; |
| 160 | 162 |
| 161 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 163 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| OLD | NEW |