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 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" | 5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 void PushMessagingServiceImpl::OnSendAcknowledged( | 200 void PushMessagingServiceImpl::OnSendAcknowledged( |
201 const std::string& app_id, | 201 const std::string& app_id, |
202 const std::string& message_id) { | 202 const std::string& message_id) { |
203 NOTREACHED() << "The Push API shouldn't have sent messages upstream"; | 203 NOTREACHED() << "The Push API shouldn't have sent messages upstream"; |
204 } | 204 } |
205 | 205 |
206 void PushMessagingServiceImpl::Register( | 206 void PushMessagingServiceImpl::Register( |
207 const GURL& origin, | 207 const GURL& origin, |
208 int64 service_worker_registration_id, | 208 int64 service_worker_registration_id, |
209 const std::string& sender_id, | 209 const std::string& sender_id, |
| 210 bool user_visible_only, |
210 int renderer_id, | 211 int renderer_id, |
211 int render_frame_id, | 212 int render_frame_id, |
212 bool user_gesture, | 213 bool user_gesture, |
213 const content::PushMessagingService::RegisterCallback& callback) { | 214 const content::PushMessagingService::RegisterCallback& callback) { |
214 if (!gcm_profile_service_->driver()) { | 215 if (!gcm_profile_service_->driver()) { |
215 NOTREACHED() << "There is no GCMDriver. Has GCMProfileService shut down?"; | 216 NOTREACHED() << "There is no GCMDriver. Has GCMProfileService shut down?"; |
216 } | 217 } |
217 | 218 |
218 PushMessagingApplicationId application_id = | 219 PushMessagingApplicationId application_id = |
219 PushMessagingApplicationId(origin, service_worker_registration_id); | 220 PushMessagingApplicationId(origin, service_worker_registration_id); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 gcm::PushMessagingPermissionContext* permission_context = | 259 gcm::PushMessagingPermissionContext* permission_context = |
259 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); | 260 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); |
260 | 261 |
261 if (permission_context == NULL) { | 262 if (permission_context == NULL) { |
262 RegisterEnd(callback, | 263 RegisterEnd(callback, |
263 std::string(), | 264 std::string(), |
264 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); | 265 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); |
265 return; | 266 return; |
266 } | 267 } |
267 | 268 |
| 269 // TODO(miguelg): Consider the value of |user_visible_only| when making |
| 270 // the permission request. |
268 permission_context->RequestPermission( | 271 permission_context->RequestPermission( |
269 web_contents, | 272 web_contents, |
270 id, | 273 id, |
271 embedder, | 274 embedder, |
272 user_gesture, | 275 user_gesture, |
273 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, | 276 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, |
274 weak_factory_.GetWeakPtr(), | 277 weak_factory_.GetWeakPtr(), |
275 application_id, | 278 application_id, |
276 sender_id, | 279 sender_id, |
277 callback)); | 280 callback)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 application_id.ToString(), | 349 application_id.ToString(), |
347 sender_ids, | 350 sender_ids, |
348 base::Bind(&PushMessagingServiceImpl::DidRegister, | 351 base::Bind(&PushMessagingServiceImpl::DidRegister, |
349 weak_factory_.GetWeakPtr(), | 352 weak_factory_.GetWeakPtr(), |
350 register_callback)); | 353 register_callback)); |
351 } | 354 } |
352 | 355 |
353 // TODO(johnme): Unregister should call DecreasePushRegistrationCount. | 356 // TODO(johnme): Unregister should call DecreasePushRegistrationCount. |
354 | 357 |
355 } // namespace gcm | 358 } // namespace gcm |
OLD | NEW |