Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/push_messaging/push_messaging_service_impl.h

Issue 1099093003: Push API: Forced notifications should use Notifications database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Peter's review nits Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
11 #include "components/content_settings/core/browser/content_settings_observer.h" 13 #include "components/content_settings/core/browser/content_settings_observer.h"
12 #include "components/content_settings/core/common/content_settings.h" 14 #include "components/content_settings/core/common/content_settings.h"
13 #include "components/gcm_driver/gcm_app_handler.h" 15 #include "components/gcm_driver/gcm_app_handler.h"
14 #include "components/gcm_driver/gcm_client.h" 16 #include "components/gcm_driver/gcm_client.h"
15 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
16 #include "content/public/browser/push_messaging_service.h" 18 #include "content/public/browser/push_messaging_service.h"
17 #include "content/public/common/push_messaging_status.h" 19 #include "content/public/common/push_messaging_status.h"
18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h" 20 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h"
19 21
20 class Profile; 22 class Profile;
21 class PushMessagingApplicationId; 23 class PushMessagingApplicationId;
22 24
23 namespace user_prefs { 25 namespace content {
24 class PrefRegistrySyncable; 26 struct NotificationDatabaseData;
27 struct PlatformNotificationData;
25 } 28 }
26 29
27 namespace gcm { 30 namespace gcm {
28 class GCMDriver; 31 class GCMDriver;
29 class GCMProfileService; 32 class GCMProfileService;
30 } 33 }
31 34
35 namespace user_prefs {
36 class PrefRegistrySyncable;
37 }
38
32 class PushMessagingServiceImpl : public content::PushMessagingService, 39 class PushMessagingServiceImpl : public content::PushMessagingService,
33 public gcm::GCMAppHandler, 40 public gcm::GCMAppHandler,
34 public content_settings::Observer, 41 public content_settings::Observer,
35 public KeyedService { 42 public KeyedService {
36 public: 43 public:
37 // Register profile-specific prefs for GCM. 44 // Register profile-specific prefs for GCM.
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 45 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39 46
40 // If any Service Workers are using push, starts GCM and adds an app handler. 47 // If any Service Workers are using push, starts GCM and adds an app handler.
41 static void InitializeForProfile(Profile* profile); 48 static void InitializeForProfile(Profile* profile);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int64 service_worker_registration_id, 113 int64 service_worker_registration_id,
107 const gcm::GCMClient::IncomingMessage& message, 114 const gcm::GCMClient::IncomingMessage& message,
108 const base::Closure& message_handled_closure, 115 const base::Closure& message_handled_closure,
109 content::PushDeliveryStatus status); 116 content::PushDeliveryStatus status);
110 117
111 // Developers are required to display a Web Notification in response to an 118 // Developers are required to display a Web Notification in response to an
112 // incoming push message in order to clarify to the user that something has 119 // incoming push message in order to clarify to the user that something has
113 // happened in the background. When they forget to do so, display a default 120 // happened in the background. When they forget to do so, display a default
114 // notification on their behalf. 121 // notification on their behalf.
115 void RequireUserVisibleUX(const GURL& requesting_origin, 122 void RequireUserVisibleUX(const GURL& requesting_origin,
116 int64 service_worker_registration_id, 123 int64_t service_worker_registration_id,
117 const base::Closure& message_handled_closure); 124 const base::Closure& message_handled_closure);
118 void DidGetNotificationsShown( 125
126 static void DidGetNotificationsFromDatabaseIOProxy(
127 const base::WeakPtr<PushMessagingServiceImpl>& ui_weak_ptr,
119 const GURL& requesting_origin, 128 const GURL& requesting_origin,
120 int64 service_worker_registration_id, 129 int64_t service_worker_registration_id,
130 const base::Closure& message_handled_closure,
131 bool success,
132 const std::vector<content::NotificationDatabaseData>& data);
133
134 void DidGetNotificationsFromDatabase(
135 const GURL& requesting_origin,
136 int64_t service_worker_registration_id,
137 const base::Closure& message_handled_closure,
138 bool success,
139 const std::vector<content::NotificationDatabaseData>& data);
140
141 void DidGetNotificationsShownAndNeeded(
142 const GURL& requesting_origin,
143 int64_t service_worker_registration_id,
121 bool notification_shown, 144 bool notification_shown,
122 bool notification_needed, 145 bool notification_needed,
123 const base::Closure& message_handled_closure, 146 const base::Closure& message_handled_closure,
124 const std::string& data, 147 const std::string& data,
125 bool success, 148 bool success,
126 bool not_found); 149 bool not_found);
127 150
151 static void DidWriteNotificationDataIOProxy(
152 const base::WeakPtr<PushMessagingServiceImpl>& ui_weak_ptr,
153 const GURL& requesting_origin,
154 const content::PlatformNotificationData& notification_data,
155 const base::Closure& message_handled_closure,
156 bool success,
157 int64_t persistent_notification_id);
158
159 void DidWriteNotificationData(
160 const GURL& requesting_origin,
161 const content::PlatformNotificationData& notification_data,
162 const base::Closure& message_handled_closure,
163 bool success,
164 int64_t persistent_notification_id);
165
128 // Register methods ---------------------------------------------------------- 166 // Register methods ----------------------------------------------------------
129 167
130 void RegisterEnd( 168 void RegisterEnd(
131 const content::PushMessagingService::RegisterCallback& callback, 169 const content::PushMessagingService::RegisterCallback& callback,
132 const std::string& registration_id, 170 const std::string& registration_id,
133 content::PushRegistrationStatus status); 171 content::PushRegistrationStatus status);
134 172
135 void DidRegister( 173 void DidRegister(
136 const PushMessagingApplicationId& application_id, 174 const PushMessagingApplicationId& application_id,
137 const content::PushMessagingService::RegisterCallback& callback, 175 const content::PushMessagingService::RegisterCallback& callback,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 213
176 base::Closure message_callback_for_testing_; 214 base::Closure message_callback_for_testing_;
177 base::Closure content_setting_changed_callback_for_testing_; 215 base::Closure content_setting_changed_callback_for_testing_;
178 216
179 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 217 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
180 218
181 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 219 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
182 }; 220 };
183 221
184 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ 222 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698