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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_service_impl.h

Issue 914693002: Push API: Fix unsubscribing from GCM on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment nits I missed earlier Created 5 years, 10 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 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "components/gcm_driver/gcm_app_handler.h" 10 #include "components/gcm_driver/gcm_app_handler.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool user_visible_only, 60 bool user_visible_only,
61 const content::PushMessagingService::RegisterCallback& callback) override; 61 const content::PushMessagingService::RegisterCallback& callback) override;
62 void RegisterFromWorker( 62 void RegisterFromWorker(
63 const GURL& requesting_origin, 63 const GURL& requesting_origin,
64 int64 service_worker_registration_id, 64 int64 service_worker_registration_id,
65 const std::string& sender_id, 65 const std::string& sender_id,
66 const content::PushMessagingService::RegisterCallback& callback) override; 66 const content::PushMessagingService::RegisterCallback& callback) override;
67 void Unregister( 67 void Unregister(
68 const GURL& requesting_origin, 68 const GURL& requesting_origin,
69 int64 service_worker_registration_id, 69 int64 service_worker_registration_id,
70 const std::string& sender_id,
70 const content::PushMessagingService::UnregisterCallback&) override; 71 const content::PushMessagingService::UnregisterCallback&) override;
71 blink::WebPushPermissionStatus GetPermissionStatus( 72 blink::WebPushPermissionStatus GetPermissionStatus(
72 const GURL& requesting_origin, 73 const GURL& requesting_origin,
73 const GURL& embedding_origin) override; 74 const GURL& embedding_origin) override;
74 75
75 void SetProfileForTesting(Profile* profile); 76 void SetProfileForTesting(Profile* profile);
76 77
77 private: 78 private:
78 // A registration is pending until it has succeeded or failed. 79 // A registration is pending until it has succeeded or failed.
79 void IncreasePushRegistrationCount(int add, bool is_pending); 80 void IncreasePushRegistrationCount(int add, bool is_pending);
(...skipping 26 matching lines...) Expand all
106 const std::string& registration_id, 107 const std::string& registration_id,
107 GCMClient::Result result); 108 GCMClient::Result result);
108 109
109 void DidRequestPermission( 110 void DidRequestPermission(
110 const PushMessagingApplicationId& application_id, 111 const PushMessagingApplicationId& application_id,
111 const std::string& sender_id, 112 const std::string& sender_id,
112 const content::PushMessagingService::RegisterCallback& callback, 113 const content::PushMessagingService::RegisterCallback& callback,
113 bool allow); 114 bool allow);
114 115
115 void Unregister(const PushMessagingApplicationId& application_id, 116 void Unregister(const PushMessagingApplicationId& application_id,
117 const std::string& sender_id,
116 const content::PushMessagingService::UnregisterCallback&); 118 const content::PushMessagingService::UnregisterCallback&);
117 119
118 void DidUnregister(const content::PushMessagingService::UnregisterCallback&, 120 void DidUnregister(const content::PushMessagingService::UnregisterCallback&,
119 GCMClient::Result result); 121 GCMClient::Result result);
120 122
121 // Helper method that checks if a given origin is allowed to use Push. 123 // Helper method that checks if a given origin is allowed to use Push.
122 bool HasPermission(const GURL& origin); 124 bool HasPermission(const GURL& origin);
123 125
124 GCMProfileService* gcm_profile_service_; // It owns us. 126 GCMProfileService* gcm_profile_service_; // It owns us.
125 127
126 Profile* profile_; // It owns our owner. 128 Profile* profile_; // It owns our owner.
127 129
128 int push_registration_count_; 130 int push_registration_count_;
129 int pending_push_registration_count_; 131 int pending_push_registration_count_;
130 132
131 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 133 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
132 134
133 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 135 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
134 }; 136 };
135 137
136 } // namespace gcm 138 } // namespace gcm
137 139
138 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 140 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698