| 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/string16.h" | 19 #include "base/strings/string16.h" |
| 20 #include "chrome/browser/notifications/notification.h" | 20 #include "chrome/browser/notifications/notification.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "content/public/browser/platform_notification_service.h" | 22 #include "content/public/browser/platform_notification_service.h" |
| 23 #include "content/public/common/persistent_notification_status.h" | 23 #include "content/public/common/persistent_notification_status.h" |
| 24 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
| 24 | 25 |
| 25 class NotificationDelegate; | 26 class NotificationDelegate; |
| 26 class NotificationUIManager; | 27 class NotificationUIManager; |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 class BrowserContext; | 30 class BrowserContext; |
| 30 struct NotificationResources; | 31 struct NotificationResources; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace gcm { | 34 namespace gcm { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 bool by_user); | 80 bool by_user); |
| 80 | 81 |
| 81 // Returns the Notification UI Manager through which notifications can be | 82 // Returns the Notification UI Manager through which notifications can be |
| 82 // displayed to the user. Can be overridden for testing. | 83 // displayed to the user. Can be overridden for testing. |
| 83 NotificationUIManager* GetNotificationUIManager() const; | 84 NotificationUIManager* GetNotificationUIManager() const; |
| 84 | 85 |
| 85 // Open the Notification settings screen when clicking the right button. | 86 // Open the Notification settings screen when clicking the right button. |
| 86 void OpenNotificationSettings(content::BrowserContext* browser_context); | 87 void OpenNotificationSettings(content::BrowserContext* browser_context); |
| 87 | 88 |
| 88 // content::PlatformNotificationService implementation. | 89 // content::PlatformNotificationService implementation. |
| 89 blink::WebNotificationPermission CheckPermissionOnUIThread( | 90 blink::mojom::PermissionStatus CheckPermissionOnUIThread( |
| 90 content::BrowserContext* browser_context, | 91 content::BrowserContext* browser_context, |
| 91 const GURL& origin, | 92 const GURL& origin, |
| 92 int render_process_id) override; | 93 int render_process_id) override; |
| 93 blink::WebNotificationPermission CheckPermissionOnIOThread( | 94 blink::mojom::PermissionStatus CheckPermissionOnIOThread( |
| 94 content::ResourceContext* resource_context, | 95 content::ResourceContext* resource_context, |
| 95 const GURL& origin, | 96 const GURL& origin, |
| 96 int render_process_id) override; | 97 int render_process_id) override; |
| 97 void DisplayNotification( | 98 void DisplayNotification( |
| 98 content::BrowserContext* browser_context, | 99 content::BrowserContext* browser_context, |
| 99 const GURL& origin, | 100 const GURL& origin, |
| 100 const content::PlatformNotificationData& notification_data, | 101 const content::PlatformNotificationData& notification_data, |
| 101 const content::NotificationResources& notification_resources, | 102 const content::NotificationResources& notification_resources, |
| 102 std::unique_ptr<content::DesktopNotificationDelegate> delegate, | 103 std::unique_ptr<content::DesktopNotificationDelegate> delegate, |
| 103 base::Closure* cancel_callback) override; | 104 base::Closure* cancel_callback) override; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::map<int64_t, std::string> persistent_notifications_; | 158 std::map<int64_t, std::string> persistent_notifications_; |
| 158 | 159 |
| 159 // Tracks the id of persistent notifications that have been closed | 160 // Tracks the id of persistent notifications that have been closed |
| 160 // programmatically to avoid dispatching close events for them. | 161 // programmatically to avoid dispatching close events for them. |
| 161 std::unordered_set<int64_t> closed_notifications_; | 162 std::unordered_set<int64_t> closed_notifications_; |
| 162 | 163 |
| 163 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 164 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 167 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
| OLD | NEW |