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/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/bind.h" | 10 #include "base/bind.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 web_contents->GetMainFrame()->AddMessageToConsole( | 378 web_contents->GetMainFrame()->AddMessageToConsole( |
379 content::CONSOLE_MESSAGE_LEVEL_ERROR, | 379 content::CONSOLE_MESSAGE_LEVEL_ERROR, |
380 kSilentPushUnsupportedMessage); | 380 kSilentPushUnsupportedMessage); |
381 | 381 |
382 SubscribeEndWithError(callback, | 382 SubscribeEndWithError(callback, |
383 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); | 383 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); |
384 return; | 384 return; |
385 } | 385 } |
386 | 386 |
387 // Push does not allow permission requests from iframes. | 387 // Push does not allow permission requests from iframes. |
388 int request_id = -1; | |
389 | |
390 profile_->GetPermissionManager()->RequestPermission( | 388 profile_->GetPermissionManager()->RequestPermission( |
391 content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(), | 389 content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(), |
392 request_id, requesting_origin, true /* user_gesture */, | 390 requesting_origin, true /* user_gesture */, |
393 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, | 391 base::Bind(&PushMessagingServiceImpl::DidRequestPermission, |
394 weak_factory_.GetWeakPtr(), app_identifier, sender_id, | 392 weak_factory_.GetWeakPtr(), app_identifier, sender_id, |
395 callback)); | 393 callback)); |
396 } | 394 } |
397 | 395 |
398 void PushMessagingServiceImpl::SubscribeFromWorker( | 396 void PushMessagingServiceImpl::SubscribeFromWorker( |
399 const GURL& requesting_origin, | 397 const GURL& requesting_origin, |
400 int64 service_worker_registration_id, | 398 int64 service_worker_registration_id, |
401 const std::string& sender_id, | 399 const std::string& sender_id, |
402 bool user_visible, | 400 bool user_visible, |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 switches::kEnablePushMessagePayload); | 778 switches::kEnablePushMessagePayload); |
781 } | 779 } |
782 | 780 |
783 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { | 781 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { |
784 gcm::GCMProfileService* gcm_profile_service = | 782 gcm::GCMProfileService* gcm_profile_service = |
785 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 783 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
786 CHECK(gcm_profile_service); | 784 CHECK(gcm_profile_service); |
787 CHECK(gcm_profile_service->driver()); | 785 CHECK(gcm_profile_service->driver()); |
788 return gcm_profile_service->driver(); | 786 return gcm_profile_service->driver(); |
789 } | 787 } |
OLD | NEW |