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

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: rebase 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 "https://goo.gl/yqv4Q4 for more details."; 61 "https://goo.gl/yqv4Q4 for more details.";
62 62
63 void RecordDeliveryStatus(content::PushDeliveryStatus status) { 63 void RecordDeliveryStatus(content::PushDeliveryStatus status) {
64 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status, 64 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status,
65 content::PUSH_DELIVERY_STATUS_LAST + 1); 65 content::PUSH_DELIVERY_STATUS_LAST + 1);
66 } 66 }
67 67
68 blink::WebPushPermissionStatus ToPushPermission( 68 blink::WebPushPermissionStatus ToPushPermission(
69 content::PermissionStatus permission_status) { 69 content::PermissionStatus permission_status) {
70 switch (permission_status) { 70 switch (permission_status) {
71 case content::PERMISSION_STATUS_GRANTED: 71 case content::PermissionStatus::GRANTED:
72 return blink::WebPushPermissionStatusGranted; 72 return blink::WebPushPermissionStatusGranted;
73 case content::PERMISSION_STATUS_DENIED: 73 case content::PermissionStatus::DENIED:
74 return blink::WebPushPermissionStatusDenied; 74 return blink::WebPushPermissionStatusDenied;
75 case content::PERMISSION_STATUS_ASK: 75 case content::PermissionStatus::ASK:
76 return blink::WebPushPermissionStatusPrompt; 76 return blink::WebPushPermissionStatusPrompt;
77 default: 77 default:
78 NOTREACHED(); 78 NOTREACHED();
79 return blink::WebPushPermissionStatusDenied; 79 return blink::WebPushPermissionStatusDenied;
80 } 80 }
81 } 81 }
82 82
83 void UnregisterCallbackToClosure(const base::Closure& closure, 83 void UnregisterCallbackToClosure(const base::Closure& closure,
84 content::PushUnregistrationStatus status) { 84 content::PushUnregistrationStatus status) {
85 closure.Run(); 85 closure.Run();
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 std::vector<uint8_t>(p256dh.begin(), p256dh.end()), 516 std::vector<uint8_t>(p256dh.begin(), p256dh.end()),
517 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()), 517 std::vector<uint8_t>(auth_secret.begin(), auth_secret.end()),
518 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); 518 content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
519 } 519 }
520 520
521 void PushMessagingServiceImpl::DidRequestPermission( 521 void PushMessagingServiceImpl::DidRequestPermission(
522 const PushMessagingAppIdentifier& app_identifier, 522 const PushMessagingAppIdentifier& app_identifier,
523 const std::string& sender_id, 523 const std::string& sender_id,
524 const content::PushMessagingService::RegisterCallback& register_callback, 524 const content::PushMessagingService::RegisterCallback& register_callback,
525 content::PermissionStatus permission_status) { 525 content::PermissionStatus permission_status) {
526 if (permission_status != content::PERMISSION_STATUS_GRANTED) { 526 if (permission_status != content::PermissionStatus::GRANTED) {
527 SubscribeEndWithError(register_callback, 527 SubscribeEndWithError(register_callback,
528 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); 528 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
529 return; 529 return;
530 } 530 }
531 531
532 IncreasePushSubscriptionCount(1, true /* is_pending */); 532 IncreasePushSubscriptionCount(1, true /* is_pending */);
533 std::vector<std::string> sender_ids(1, sender_id); 533 std::vector<std::string> sender_ids(1, sender_id);
534 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids, 534 GetGCMDriver()->Register(app_identifier.app_id(), sender_ids,
535 base::Bind(&PushMessagingServiceImpl::DidSubscribe, 535 base::Bind(&PushMessagingServiceImpl::DidSubscribe,
536 weak_factory_.GetWeakPtr(), 536 weak_factory_.GetWeakPtr(),
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 switches::kEnableExperimentalWebPlatformFeatures); 771 switches::kEnableExperimentalWebPlatformFeatures);
772 } 772 }
773 773
774 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { 774 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const {
775 gcm::GCMProfileService* gcm_profile_service = 775 gcm::GCMProfileService* gcm_profile_service =
776 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 776 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
777 CHECK(gcm_profile_service); 777 CHECK(gcm_profile_service);
778 CHECK(gcm_profile_service->driver()); 778 CHECK(gcm_profile_service->driver());
779 return gcm_profile_service->driver(); 779 return gcm_profile_service->driver();
780 } 780 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_uma_util.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698