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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: Created 4 years, 11 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 "https://goo.gl/yqv4Q4 for more details."; 60 "https://goo.gl/yqv4Q4 for more details.";
61 61
62 void RecordDeliveryStatus(content::PushDeliveryStatus status) { 62 void RecordDeliveryStatus(content::PushDeliveryStatus status) {
63 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status, 63 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status,
64 content::PUSH_DELIVERY_STATUS_LAST + 1); 64 content::PUSH_DELIVERY_STATUS_LAST + 1);
65 } 65 }
66 66
67 blink::WebPushPermissionStatus ToPushPermission( 67 blink::WebPushPermissionStatus ToPushPermission(
68 content::PermissionStatus permission_status) { 68 content::PermissionStatus permission_status) {
69 switch (permission_status) { 69 switch (permission_status) {
70 case content::PERMISSION_STATUS_GRANTED: 70 case content::PermissionStatus::GRANTED:
71 return blink::WebPushPermissionStatusGranted; 71 return blink::WebPushPermissionStatusGranted;
72 case content::PERMISSION_STATUS_DENIED: 72 case content::PermissionStatus::DENIED:
73 return blink::WebPushPermissionStatusDenied; 73 return blink::WebPushPermissionStatusDenied;
74 case content::PERMISSION_STATUS_ASK: 74 case content::PermissionStatus::ASK:
75 return blink::WebPushPermissionStatusPrompt; 75 return blink::WebPushPermissionStatusPrompt;
76 default: 76 default:
77 NOTREACHED(); 77 NOTREACHED();
78 return blink::WebPushPermissionStatusDenied; 78 return blink::WebPushPermissionStatusDenied;
79 } 79 }
80 } 80 }
81 81
82 void UnregisterCallbackToClosure(const base::Closure& closure, 82 void UnregisterCallbackToClosure(const base::Closure& closure,
83 content::PushUnregistrationStatus status) { 83 content::PushUnregistrationStatus status) {
84 closure.Run(); 84 closure.Run();
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 std::vector<uint8_t>(p256dh.begin(), p256dh.end()), 517 std::vector<uint8_t>(p256dh.begin(), p256dh.end()),
518 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()), 518 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()),
519 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); 519 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
520 } 520 }
521 521
522 void PushMessagingServiceImpl::DidRequestPermission( 522 void PushMessagingServiceImpl::DidRequestPermission(
523 const PushMessagingAppIdentifier& app_identifier, 523 const PushMessagingAppIdentifier& app_identifier,
524 const std::string& sender_id, 524 const std::string& sender_id,
525 const content::PushMessagingService::RegisterCallback& register_callback, 525 const content::PushMessagingService::RegisterCallback& register_callback,
526 content::PermissionStatus permission_status) { 526 content::PermissionStatus permission_status) {
527 if (permission_status != content::PERMISSION_STATUS_GRANTED) { 527 if (permission_status != content::PermissionStatus::GRANTED) {
528 SubscribeEndWithError(register_callback, 528 SubscribeEndWithError(register_callback,
529 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); 529 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
530 return; 530 return;
531 } 531 }
532 532
533 IncreasePushSubscriptionCount(1, true /* is_pending */); 533 IncreasePushSubscriptionCount(1, true /* is_pending */);
534 std::vector<std::string> sender_ids(1, sender_id); 534 std::vector<std::string> sender_ids(1, sender_id);
535 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids, 535 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids,
536 base::Bind(&PushMessagingServiceImpl::DidSubscribe, 536 base::Bind(&PushMessagingServiceImpl::DidSubscribe,
537 weak_factory_.GetWeakPtr(), 537 weak_factory_.GetWeakPtr(),
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 switches::kEnableExperimentalWebPlatformFeatures); 772 switches::kEnableExperimentalWebPlatformFeatures);
773 } 773 }
774 774
775 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { 775 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const {
776 gcm::GCMProfileService* gcm_profile_service = 776 gcm::GCMProfileService* gcm_profile_service =
777 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 777 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
778 CHECK(gcm_profile_service); 778 CHECK(gcm_profile_service);
779 CHECK(gcm_profile_service->driver()); 779 CHECK(gcm_profile_service->driver());
780 return gcm_profile_service->driver(); 780 return gcm_profile_service->driver();
781 } 781 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698