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 CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
16 #include "content/public/browser/notification_database_data.h" | 17 #include "content/public/browser/notification_database_data.h" |
17 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onPermission.h" | 18 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onPermission.h" |
18 | 19 |
19 class GURL; | 20 class GURL; |
20 class SkBitmap; | |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class BrowserContext; | 24 class BrowserContext; |
| 25 struct NotificationResources; |
25 class PlatformNotificationContextImpl; | 26 class PlatformNotificationContextImpl; |
26 struct PlatformNotificationData; | 27 struct PlatformNotificationData; |
27 class PlatformNotificationService; | 28 class PlatformNotificationService; |
28 class ResourceContext; | 29 class ResourceContext; |
29 | 30 |
30 class NotificationMessageFilter : public BrowserMessageFilter { | 31 class NotificationMessageFilter : public BrowserMessageFilter { |
31 public: | 32 public: |
32 NotificationMessageFilter( | 33 NotificationMessageFilter( |
33 int process_id, | 34 int process_id, |
34 PlatformNotificationContextImpl* notification_context, | 35 PlatformNotificationContextImpl* notification_context, |
(...skipping 15 matching lines...) Expand all Loading... |
50 | 51 |
51 private: | 52 private: |
52 friend class base::DeleteHelper<NotificationMessageFilter>; | 53 friend class base::DeleteHelper<NotificationMessageFilter>; |
53 friend class BrowserThread; | 54 friend class BrowserThread; |
54 | 55 |
55 void OnCheckNotificationPermission( | 56 void OnCheckNotificationPermission( |
56 const GURL& origin, blink::WebNotificationPermission* permission); | 57 const GURL& origin, blink::WebNotificationPermission* permission); |
57 void OnShowPlatformNotification( | 58 void OnShowPlatformNotification( |
58 int notification_id, | 59 int notification_id, |
59 const GURL& origin, | 60 const GURL& origin, |
60 const SkBitmap& icon, | 61 const PlatformNotificationData& notification_data, |
61 const PlatformNotificationData& notification_data); | 62 const NotificationResources& notification_resources); |
62 void OnShowPersistentNotification( | 63 void OnShowPersistentNotification( |
63 int request_id, | 64 int request_id, |
64 int64_t service_worker_registration_id, | 65 int64_t service_worker_registration_id, |
65 const GURL& origin, | 66 const GURL& origin, |
66 const SkBitmap& icon, | 67 const PlatformNotificationData& notification_data, |
67 const PlatformNotificationData& notification_data); | 68 const NotificationResources& notification_resources); |
68 void OnGetNotifications(int request_id, | 69 void OnGetNotifications(int request_id, |
69 int64_t service_worker_registration_id, | 70 int64_t service_worker_registration_id, |
70 const GURL& origin, | 71 const GURL& origin, |
71 const std::string& filter_tag); | 72 const std::string& filter_tag); |
72 void OnClosePlatformNotification(int notification_id); | 73 void OnClosePlatformNotification(int notification_id); |
73 void OnClosePersistentNotification(const GURL& origin, | 74 void OnClosePersistentNotification(const GURL& origin, |
74 int64_t persistent_notification_id); | 75 int64_t persistent_notification_id); |
75 | 76 |
76 // Callback to be invoked by the notification context when the notification | 77 // Callback to be invoked by the notification context when the notification |
77 // data for the persistent notification may have been written, as indicated by | 78 // data for the persistent notification may have been written, as indicated by |
78 // |success|. Will present the notification to the user when successful. | 79 // |success|. Will present the notification to the user when successful. |
79 void DidWritePersistentNotificationData( | 80 void DidWritePersistentNotificationData( |
80 int request_id, | 81 int request_id, |
81 const GURL& origin, | 82 const GURL& origin, |
82 const SkBitmap& icon, | |
83 const PlatformNotificationData& notification_data, | 83 const PlatformNotificationData& notification_data, |
| 84 const NotificationResources& notification_resources, |
84 bool success, | 85 bool success, |
85 int64_t persistent_notification_id); | 86 int64_t persistent_notification_id); |
86 | 87 |
87 // Callback to be invoked when all notifications belonging to a Service Worker | 88 // Callback to be invoked when all notifications belonging to a Service Worker |
88 // registration have been read from the database. The |success| argument | 89 // registration have been read from the database. The |success| argument |
89 // indicates whether the data could be read successfully, whereas the actual | 90 // indicates whether the data could be read successfully, whereas the actual |
90 // notifications will be stored in |notifications|. | 91 // notifications will be stored in |notifications|. |
91 void DidGetNotifications( | 92 void DidGetNotifications( |
92 int request_id, | 93 int request_id, |
93 const std::string& filter_tag, | 94 const std::string& filter_tag, |
(...skipping 27 matching lines...) Expand all Loading... |
121 std::map<int, base::Closure> close_closures_; | 122 std::map<int, base::Closure> close_closures_; |
122 | 123 |
123 base::WeakPtrFactory<NotificationMessageFilter> weak_factory_io_; | 124 base::WeakPtrFactory<NotificationMessageFilter> weak_factory_io_; |
124 | 125 |
125 DISALLOW_COPY_AND_ASSIGN(NotificationMessageFilter); | 126 DISALLOW_COPY_AND_ASSIGN(NotificationMessageFilter); |
126 }; | 127 }; |
127 | 128 |
128 } // namespace content | 129 } // namespace content |
129 | 130 |
130 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ | 131 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_MESSAGE_FILTER_H_ |
OLD | NEW |