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

Side by Side Diff: content/child/notifications/notification_manager.cc

Issue 2489883006: Replace registration_id() with registrationId() (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | content/child/push_messaging/push_provider.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 #include "content/child/notifications/notification_manager.h" 5 #include "content/child/notifications/notification_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 std::unique_ptr<blink::WebNotificationResources> notification_resources, 113 std::unique_ptr<blink::WebNotificationResources> notification_resources,
114 blink::WebServiceWorkerRegistration* service_worker_registration, 114 blink::WebServiceWorkerRegistration* service_worker_registration,
115 blink::WebNotificationShowCallbacks* callbacks) { 115 blink::WebNotificationShowCallbacks* callbacks) {
116 DCHECK(service_worker_registration); 116 DCHECK(service_worker_registration);
117 DCHECK_EQ(notification_data.actions.size(), 117 DCHECK_EQ(notification_data.actions.size(),
118 notification_resources->actionIcons.size()); 118 notification_resources->actionIcons.size());
119 119
120 int64_t service_worker_registration_id = 120 int64_t service_worker_registration_id =
121 static_cast<WebServiceWorkerRegistrationImpl*>( 121 static_cast<WebServiceWorkerRegistrationImpl*>(
122 service_worker_registration) 122 service_worker_registration)
123 ->registration_id(); 123 ->registrationId();
124 124
125 std::unique_ptr<blink::WebNotificationShowCallbacks> owned_callbacks( 125 std::unique_ptr<blink::WebNotificationShowCallbacks> owned_callbacks(
126 callbacks); 126 callbacks);
127 127
128 // Verify that the author-provided payload size does not exceed our limit. 128 // Verify that the author-provided payload size does not exceed our limit.
129 // This is an implementation-defined limit to prevent abuse of notification 129 // This is an implementation-defined limit to prevent abuse of notification
130 // data as a storage mechanism. A UMA histogram records the requested sizes, 130 // data as a storage mechanism. A UMA histogram records the requested sizes,
131 // which enables us to track how much data authors are attempting to store. 131 // which enables us to track how much data authors are attempting to store.
132 // 132 //
133 // If the size exceeds this limit, reject the showNotification() promise. This 133 // If the size exceeds this limit, reject the showNotification() promise. This
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 blink::WebNotificationGetCallbacks* callbacks) { 165 blink::WebNotificationGetCallbacks* callbacks) {
166 DCHECK(service_worker_registration); 166 DCHECK(service_worker_registration);
167 DCHECK(callbacks); 167 DCHECK(callbacks);
168 168
169 WebServiceWorkerRegistrationImpl* service_worker_registration_impl = 169 WebServiceWorkerRegistrationImpl* service_worker_registration_impl =
170 static_cast<WebServiceWorkerRegistrationImpl*>( 170 static_cast<WebServiceWorkerRegistrationImpl*>(
171 service_worker_registration); 171 service_worker_registration);
172 172
173 GURL origin = GURL(service_worker_registration_impl->scope()).GetOrigin(); 173 GURL origin = GURL(service_worker_registration_impl->scope()).GetOrigin();
174 int64_t service_worker_registration_id = 174 int64_t service_worker_registration_id =
175 service_worker_registration_impl->registration_id(); 175 service_worker_registration_impl->registrationId();
176 176
177 // TODO(peter): GenerateNotificationId is more of a request id. Consider 177 // TODO(peter): GenerateNotificationId is more of a request id. Consider
178 // renaming the method in the NotificationDispatcher if this makes sense. 178 // renaming the method in the NotificationDispatcher if this makes sense.
179 int request_id = 179 int request_id =
180 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId()); 180 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId());
181 181
182 pending_get_notification_requests_.AddWithID(callbacks, request_id); 182 pending_get_notification_requests_.AddWithID(callbacks, request_id);
183 183
184 thread_safe_sender_->Send(new PlatformNotificationHostMsg_GetNotifications( 184 thread_safe_sender_->Send(new PlatformNotificationHostMsg_GetNotifications(
185 request_id, service_worker_registration_id, origin, 185 request_id, service_worker_registration_id, origin,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 notifications[i] = web_notification_info; 305 notifications[i] = web_notification_info;
306 } 306 }
307 307
308 callbacks->onSuccess(notifications); 308 callbacks->onSuccess(notifications);
309 309
310 pending_get_notification_requests_.Remove(request_id); 310 pending_get_notification_requests_.Remove(request_id);
311 } 311 }
312 312
313 } // namespace content 313 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/push_messaging/push_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698