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_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "components/content_settings/core/browser/content_settings_observer.h" | 11 #include "components/content_settings/core/browser/content_settings_observer.h" |
12 #include "components/content_settings/core/common/content_settings.h" | 12 #include "components/content_settings/core/common/content_settings.h" |
13 #include "components/gcm_driver/gcm_app_handler.h" | 13 #include "components/gcm_driver/gcm_app_handler.h" |
14 #include "components/gcm_driver/gcm_client.h" | 14 #include "components/gcm_driver/gcm_client.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
16 #include "content/public/browser/push_messaging_service.h" | 16 #include "content/public/browser/push_messaging_service.h" |
17 #include "content/public/common/push_messaging_status.h" | 17 #include "content/public/common/push_messaging_status.h" |
18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" | 18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" |
19 | 19 |
20 class Profile; | 20 class Profile; |
21 class PushMessagingApplicationId; | 21 class PushMessagingApplicationId; |
22 | 22 |
23 namespace user_prefs { | 23 namespace content { |
24 class PrefRegistrySyncable; | 24 struct NotificationDatabaseData; |
25 } | 25 } |
26 | 26 |
27 namespace gcm { | 27 namespace gcm { |
28 class GCMDriver; | 28 class GCMDriver; |
29 class GCMProfileService; | 29 class GCMProfileService; |
30 } | 30 } |
31 | 31 |
| 32 namespace user_prefs { |
| 33 class PrefRegistrySyncable; |
| 34 } |
| 35 |
32 class PushMessagingServiceImpl : public content::PushMessagingService, | 36 class PushMessagingServiceImpl : public content::PushMessagingService, |
33 public gcm::GCMAppHandler, | 37 public gcm::GCMAppHandler, |
34 public content_settings::Observer, | 38 public content_settings::Observer, |
35 public KeyedService { | 39 public KeyedService { |
36 public: | 40 public: |
37 // Register profile-specific prefs for GCM. | 41 // Register profile-specific prefs for GCM. |
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 42 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
39 | 43 |
40 // If any Service Workers are using push, starts GCM and adds an app handler. | 44 // If any Service Workers are using push, starts GCM and adds an app handler. |
41 static void InitializeForProfile(Profile* profile); | 45 static void InitializeForProfile(Profile* profile); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int64 service_worker_registration_id, | 109 int64 service_worker_registration_id, |
106 const gcm::GCMClient::IncomingMessage& message, | 110 const gcm::GCMClient::IncomingMessage& message, |
107 content::PushDeliveryStatus status); | 111 content::PushDeliveryStatus status); |
108 | 112 |
109 // Developers are required to display a Web Notification in response to an | 113 // Developers are required to display a Web Notification in response to an |
110 // incoming push message in order to clarify to the user that something has | 114 // incoming push message in order to clarify to the user that something has |
111 // happened in the background. When they forget to do so, display a default | 115 // happened in the background. When they forget to do so, display a default |
112 // notification on their behalf. | 116 // notification on their behalf. |
113 void RequireUserVisibleUX(const GURL& requesting_origin, | 117 void RequireUserVisibleUX(const GURL& requesting_origin, |
114 int64 service_worker_registration_id); | 118 int64 service_worker_registration_id); |
| 119 |
| 120 void DidGetNotificationsShowing( |
| 121 const GURL& requesting_origin, |
| 122 int64 service_worker_registration_id, |
| 123 bool success, |
| 124 const std::vector<content::NotificationDatabaseData>& data); |
| 125 |
115 void DidGetNotificationsShown( | 126 void DidGetNotificationsShown( |
116 const GURL& requesting_origin, | 127 const GURL& requesting_origin, |
117 int64 service_worker_registration_id, | 128 int64 service_worker_registration_id, |
118 bool notification_shown, | 129 bool notification_shown, |
119 bool notification_needed, | 130 bool notification_needed, |
120 const std::string& data, | 131 const std::string& data, |
121 bool success, | 132 bool success, |
122 bool not_found); | 133 bool not_found); |
123 | 134 |
124 // Register methods ---------------------------------------------------------- | 135 // Register methods ---------------------------------------------------------- |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int pending_push_registration_count_; | 181 int pending_push_registration_count_; |
171 | 182 |
172 base::Closure content_setting_changed_callback_for_testing_; | 183 base::Closure content_setting_changed_callback_for_testing_; |
173 | 184 |
174 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 185 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
175 | 186 |
176 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 187 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
177 }; | 188 }; |
178 | 189 |
179 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 190 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |