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

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

Issue 785993003: [Push] Register: require user-visible to be present in the manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test after mock behavior change that was recently introduced 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // implemented. 268 // implemented.
269 int bridge_id = -1; 269 int bridge_id = -1;
270 270
271 const PermissionRequestID id( 271 const PermissionRequestID id(
272 renderer_id, web_contents->GetRoutingID(), bridge_id, GURL()); 272 renderer_id, web_contents->GetRoutingID(), bridge_id, GURL());
273 273
274 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 274 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
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 || !user_visible_only) {
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 285 // TODO(miguelg): Consider the value of |user_visible_only| when making
286 // the permission request. 286 // the permission request.
287 // TODO(mlamouri): Move requesting Push permission over to using Mojo, and 287 // TODO(mlamouri): Move requesting Push permission over to using Mojo, and
288 // re-introduce the ability of |user_gesture| when bubbles require this. 288 // re-introduce the ability of |user_gesture| when bubbles require this.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 442 }
443 443
444 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { 444 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() {
445 if (gcm_profile_service_->driver()->GetAppHandler( 445 if (gcm_profile_service_->driver()->GetAppHandler(
446 kPushMessagingApplicationIdPrefix) != this) 446 kPushMessagingApplicationIdPrefix) != this)
447 gcm_profile_service_->driver()->AddAppHandler( 447 gcm_profile_service_->driver()->AddAppHandler(
448 kPushMessagingApplicationIdPrefix, this); 448 kPushMessagingApplicationIdPrefix, this);
449 } 449 }
450 450
451 } // namespace gcm 451 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/push_messaging_permission_context_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698