| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |