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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_service_impl.cc

Issue 770023002: Push registration should read a "gcm_user_visible_only" key from the Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 "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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 GURL PushMessagingServiceImpl::PushEndpoint() { 222 GURL PushMessagingServiceImpl::PushEndpoint() {
223 return GURL(std::string(kPushMessagingEndpoint)); 223 return GURL(std::string(kPushMessagingEndpoint));
224 } 224 }
225 225
226 void PushMessagingServiceImpl::RegisterFromDocument( 226 void PushMessagingServiceImpl::RegisterFromDocument(
227 const GURL& requesting_origin, 227 const GURL& requesting_origin,
228 int64 service_worker_registration_id, 228 int64 service_worker_registration_id,
229 const std::string& sender_id, 229 const std::string& sender_id,
230 int renderer_id, 230 int renderer_id,
231 int render_frame_id, 231 int render_frame_id,
232 bool user_gesture, 232 bool user_visible_only,
233 const content::PushMessagingService::RegisterCallback& callback) { 233 const content::PushMessagingService::RegisterCallback& callback) {
234 if (!gcm_profile_service_->driver()) { 234 if (!gcm_profile_service_->driver()) {
235 NOTREACHED() << "There is no GCMDriver. Has GCMProfileService shut down?"; 235 NOTREACHED() << "There is no GCMDriver. Has GCMProfileService shut down?";
236 return; 236 return;
237 } 237 }
238 238
239 PushMessagingApplicationId application_id = PushMessagingApplicationId( 239 PushMessagingApplicationId application_id = PushMessagingApplicationId(
240 requesting_origin, service_worker_registration_id); 240 requesting_origin, service_worker_registration_id);
241 DCHECK(application_id.IsValid()); 241 DCHECK(application_id.IsValid());
242 242
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 gcm::PushMessagingPermissionContext* permission_context = 275 gcm::PushMessagingPermissionContext* permission_context =
276 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); 276 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_);
277 277
278 if (permission_context == NULL) { 278 if (permission_context == NULL) {
279 RegisterEnd(callback, 279 RegisterEnd(callback,
280 std::string(), 280 std::string(),
281 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); 281 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
282 return; 282 return;
283 } 283 }
284 284
285 // TODO(miguelg): Consider the value of |user_visible_only| when making
286 // the permission request.
287 // TODO(mlamouri): Move requesting Push permission over to using Mojo, and
288 // re-introduce the ability of |user_gesture| when bubbles require this.
mlamouri (slow - plz ping) 2014/12/03 15:29:01 Could you point to the bug. plz.
Peter Beverloo 2014/12/03 15:41:10 Pointed to 423770.
285 permission_context->RequestPermission( 289 permission_context->RequestPermission(
286 web_contents, id, embedding_origin, user_gesture, 290 web_contents, id, embedding_origin, true /* user_gesture */,
johnme 2014/12/03 15:36:31 It's not clear from https://crbug.com/423770 what
Peter Beverloo 2014/12/03 15:41:10 Negative. Push is the feature using IPC-based perm
287 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, 291 base::Bind(&PushMessagingServiceImpl::DidRequestPermission,
288 weak_factory_.GetWeakPtr(), application_id, sender_id, 292 weak_factory_.GetWeakPtr(), application_id, sender_id,
289 callback)); 293 callback));
290 } 294 }
291 295
292 void PushMessagingServiceImpl::RegisterFromWorker( 296 void PushMessagingServiceImpl::RegisterFromWorker(
293 const GURL& requesting_origin, 297 const GURL& requesting_origin,
294 int64 service_worker_registration_id, 298 int64 service_worker_registration_id,
295 const std::string& sender_id, 299 const std::string& sender_id,
296 const content::PushMessagingService::RegisterCallback& register_callback) { 300 const content::PushMessagingService::RegisterCallback& register_callback) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 441 }
438 442
439 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { 443 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() {
440 if (gcm_profile_service_->driver()->GetAppHandler( 444 if (gcm_profile_service_->driver()->GetAppHandler(
441 kPushMessagingApplicationIdPrefix) != this) 445 kPushMessagingApplicationIdPrefix) != this)
442 gcm_profile_service_->driver()->AddAppHandler( 446 gcm_profile_service_->driver()->AddAppHandler(
443 kPushMessagingApplicationIdPrefix, this); 447 kPushMessagingApplicationIdPrefix, this);
444 } 448 }
445 449
446 } // namespace gcm 450 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698