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

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

Issue 1771743002: Move geolocation and permission mojoms into WebKit/public/platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/bind.h" 10 #include "base/bind.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 "result in user-visible messages. You can indicate this by calling " 61 "result in user-visible messages. You can indicate this by calling "
62 "pushManager.subscribe({userVisibleOnly: true}) instead. See " 62 "pushManager.subscribe({userVisibleOnly: true}) instead. See "
63 "https://goo.gl/yqv4Q4 for more details."; 63 "https://goo.gl/yqv4Q4 for more details.";
64 64
65 void RecordDeliveryStatus(content::PushDeliveryStatus status) { 65 void RecordDeliveryStatus(content::PushDeliveryStatus status) {
66 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status, 66 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status,
67 content::PUSH_DELIVERY_STATUS_LAST + 1); 67 content::PUSH_DELIVERY_STATUS_LAST + 1);
68 } 68 }
69 69
70 blink::WebPushPermissionStatus ToPushPermission( 70 blink::WebPushPermissionStatus ToPushPermission(
71 content::mojom::PermissionStatus permission_status) { 71 blink::mojom::PermissionStatus permission_status) {
72 switch (permission_status) { 72 switch (permission_status) {
73 case content::mojom::PermissionStatus::GRANTED: 73 case blink::mojom::PermissionStatus::GRANTED:
74 return blink::WebPushPermissionStatusGranted; 74 return blink::WebPushPermissionStatusGranted;
75 case content::mojom::PermissionStatus::DENIED: 75 case blink::mojom::PermissionStatus::DENIED:
76 return blink::WebPushPermissionStatusDenied; 76 return blink::WebPushPermissionStatusDenied;
77 case content::mojom::PermissionStatus::ASK: 77 case blink::mojom::PermissionStatus::ASK:
78 return blink::WebPushPermissionStatusPrompt; 78 return blink::WebPushPermissionStatusPrompt;
79 default: 79 default:
80 NOTREACHED(); 80 NOTREACHED();
81 return blink::WebPushPermissionStatusDenied; 81 return blink::WebPushPermissionStatusDenied;
82 } 82 }
83 } 83 }
84 84
85 void UnregisterCallbackToClosure(const base::Closure& closure, 85 void UnregisterCallbackToClosure(const base::Closure& closure,
86 content::PushUnregistrationStatus status) { 86 content::PushUnregistrationStatus status) {
87 closure.Run(); 87 closure.Run();
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 SubscribeEnd(callback, subscription_id, 510 SubscribeEnd(callback, subscription_id,
511 std::vector<uint8_t>(p256dh.begin(), p256dh.end()), 511 std::vector<uint8_t>(p256dh.begin(), p256dh.end()),
512 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()), 512 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()),
513 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); 513 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
514 } 514 }
515 515
516 void PushMessagingServiceImpl::DidRequestPermission( 516 void PushMessagingServiceImpl::DidRequestPermission(
517 const PushMessagingAppIdentifier& app_identifier, 517 const PushMessagingAppIdentifier& app_identifier,
518 const content::PushSubscriptionOptions& options, 518 const content::PushSubscriptionOptions& options,
519 const content::PushMessagingService::RegisterCallback& register_callback, 519 const content::PushMessagingService::RegisterCallback& register_callback,
520 content::mojom::PermissionStatus permission_status) { 520 blink::mojom::PermissionStatus permission_status) {
521 if (permission_status != content::mojom::PermissionStatus::GRANTED) { 521 if (permission_status != blink::mojom::PermissionStatus::GRANTED) {
522 SubscribeEndWithError(register_callback, 522 SubscribeEndWithError(register_callback,
523 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); 523 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
524 return; 524 return;
525 } 525 }
526 526
527 IncreasePushSubscriptionCount(1, true /* is_pending */); 527 IncreasePushSubscriptionCount(1, true /* is_pending */);
528 std::vector<std::string> sender_ids(1, options.sender_info); 528 std::vector<std::string> sender_ids(1, options.sender_info);
529 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids, 529 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids,
530 base::Bind(&PushMessagingServiceImpl::DidSubscribe, 530 base::Bind(&PushMessagingServiceImpl::DidSubscribe,
531 weak_factory_.GetWeakPtr(), 531 weak_factory_.GetWeakPtr(),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 blink::WebPushPermissionStatusGranted; 754 blink::WebPushPermissionStatusGranted;
755 } 755 }
756 756
757 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { 757 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const {
758 gcm::GCMProfileService* gcm_profile_service = 758 gcm::GCMProfileService* gcm_profile_service =
759 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 759 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
760 CHECK(gcm_profile_service); 760 CHECK(gcm_profile_service);
761 CHECK(gcm_profile_service->driver()); 761 CHECK(gcm_profile_service->driver());
762 return gcm_profile_service->driver(); 762 return gcm_profile_service->driver();
763 } 763 }
OLDNEW
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_service_impl.h ('k') | chromecast/browser/cast_permission_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698