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 #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 Loading... |
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 bool retry_on_failure, | 71 bool retry_on_failure, |
71 const content::PushMessagingService::UnregisterCallback&) override; | 72 const content::PushMessagingService::UnregisterCallback&) override; |
72 blink::WebPushPermissionStatus GetPermissionStatus( | 73 blink::WebPushPermissionStatus GetPermissionStatus( |
73 const GURL& requesting_origin, | 74 const GURL& requesting_origin, |
74 const GURL& embedding_origin) override; | 75 const GURL& embedding_origin) override; |
75 | 76 |
76 void SetProfileForTesting(Profile* profile); | 77 void SetProfileForTesting(Profile* profile); |
77 | 78 |
78 private: | 79 private: |
79 // A registration is pending until it has succeeded or failed. | 80 // A registration is pending until it has succeeded or failed. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 const std::string& registration_id, | 113 const std::string& registration_id, |
113 GCMClient::Result result); | 114 GCMClient::Result result); |
114 | 115 |
115 void DidRequestPermission( | 116 void DidRequestPermission( |
116 const PushMessagingApplicationId& application_id, | 117 const PushMessagingApplicationId& application_id, |
117 const std::string& sender_id, | 118 const std::string& sender_id, |
118 const content::PushMessagingService::RegisterCallback& callback, | 119 const content::PushMessagingService::RegisterCallback& callback, |
119 bool allow); | 120 bool allow); |
120 | 121 |
121 void Unregister(const std::string& app_id_guid, | 122 void Unregister(const std::string& app_id_guid, |
| 123 const std::string& sender_id, |
122 bool retry_on_failure, | 124 bool retry_on_failure, |
123 const content::PushMessagingService::UnregisterCallback&); | 125 const content::PushMessagingService::UnregisterCallback&); |
124 | 126 |
125 void DidUnregister(const std::string& app_id_guid, | 127 void DidUnregister(const std::string& app_id_guid, |
126 bool retry_on_failure, | 128 bool retry_on_failure, |
127 const content::PushMessagingService::UnregisterCallback&, | 129 const content::PushMessagingService::UnregisterCallback&, |
128 GCMClient::Result result); | 130 GCMClient::Result result); |
129 | 131 |
130 // Helper method that checks if a given origin is allowed to use Push. | 132 // Helper method that checks if a given origin is allowed to use Push. |
131 bool HasPermission(const GURL& origin); | 133 bool HasPermission(const GURL& origin); |
132 | 134 |
133 GCMProfileService* gcm_profile_service_; // It owns us. | 135 GCMProfileService* gcm_profile_service_; // It owns us. |
134 | 136 |
135 Profile* profile_; // It owns our owner. | 137 Profile* profile_; // It owns our owner. |
136 | 138 |
137 int push_registration_count_; | 139 int push_registration_count_; |
138 int pending_push_registration_count_; | 140 int pending_push_registration_count_; |
139 | 141 |
140 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 142 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
141 | 143 |
142 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 144 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
143 }; | 145 }; |
144 | 146 |
145 } // namespace gcm | 147 } // namespace gcm |
146 | 148 |
147 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ | 149 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |