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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_service_impl.cc

Issue 2110343002: Reintroduce plumbing for user gesture into permission system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 4 years, 5 months 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/push_messaging/push_messaging_service_impl.h" 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/barrier_closure.h" 9 #include "base/barrier_closure.h"
10 #include "base/base64url.h" 10 #include "base/base64url.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 content::CONSOLE_MESSAGE_LEVEL_ERROR, kSilentPushUnsupportedMessage); 391 content::CONSOLE_MESSAGE_LEVEL_ERROR, kSilentPushUnsupportedMessage);
392 392
393 SubscribeEndWithError(callback, 393 SubscribeEndWithError(callback,
394 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); 394 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
395 return; 395 return;
396 } 396 }
397 397
398 // Push does not allow permission requests from iframes. 398 // Push does not allow permission requests from iframes.
399 profile_->GetPermissionManager()->RequestPermission( 399 profile_->GetPermissionManager()->RequestPermission(
400 content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(), 400 content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(),
401 requesting_origin, 401 requesting_origin, true /* user_gesture */,
402 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, 402 base::Bind(&PushMessagingServiceImpl::DidRequestPermission,
403 weak_factory_.GetWeakPtr(), app_identifier, options, 403 weak_factory_.GetWeakPtr(), app_identifier, options,
404 callback)); 404 callback));
405 } 405 }
406 406
407 void PushMessagingServiceImpl::SubscribeFromWorker( 407 void PushMessagingServiceImpl::SubscribeFromWorker(
408 const GURL& requesting_origin, 408 const GURL& requesting_origin,
409 int64_t service_worker_registration_id, 409 int64_t service_worker_registration_id,
410 const content::PushSubscriptionOptions& options, 410 const content::PushSubscriptionOptions& options,
411 const content::PushMessagingService::RegisterCallback& register_callback) { 411 const content::PushMessagingService::RegisterCallback& register_callback) {
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 blink::WebPushPermissionStatusGranted; 792 blink::WebPushPermissionStatusGranted;
793 } 793 }
794 794
795 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { 795 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const {
796 gcm::GCMProfileService* gcm_profile_service = 796 gcm::GCMProfileService* gcm_profile_service =
797 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 797 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
798 CHECK(gcm_profile_service); 798 CHECK(gcm_profile_service);
799 CHECK(gcm_profile_service->driver()); 799 CHECK(gcm_profile_service->driver());
800 return gcm_profile_service->driver(); 800 return gcm_profile_service->driver();
801 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698