| 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 CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // Subscribe the given |options.sender_info| with the push messaging service. | 61 // Subscribe the given |options.sender_info| with the push messaging service. |
| 62 // The frame is not known so if permission was not previously granted by the | 62 // The frame is not known so if permission was not previously granted by the |
| 63 // user this request should fail. | 63 // user this request should fail. |
| 64 virtual void SubscribeFromWorker(const GURL& requesting_origin, | 64 virtual void SubscribeFromWorker(const GURL& requesting_origin, |
| 65 int64_t service_worker_registration_id, | 65 int64_t service_worker_registration_id, |
| 66 const PushSubscriptionOptions& options, | 66 const PushSubscriptionOptions& options, |
| 67 const RegisterCallback& callback) = 0; | 67 const RegisterCallback& callback) = 0; |
| 68 | 68 |
| 69 // Retrieves the encryption information associated with the subscription | 69 // Retrieves the encryption information associated with the subscription |
| 70 // associated to |origin| and |service_worker_registration_id|. | 70 // associated to |origin| and |service_worker_registration_id|. |sender_id| is |
| 71 // also required since an InstanceID might have multiple tokens associated |
| 72 // with different senders, though in practice Push doesn't yet use that. |
| 71 virtual void GetEncryptionInfo(const GURL& origin, | 73 virtual void GetEncryptionInfo(const GURL& origin, |
| 72 int64_t service_worker_registration_id, | 74 int64_t service_worker_registration_id, |
| 75 const std::string& sender_id, |
| 73 const EncryptionInfoCallback& callback) = 0; | 76 const EncryptionInfoCallback& callback) = 0; |
| 74 | 77 |
| 75 // Unsubscribe the given |sender_id| from the push messaging service. The | 78 // Unsubscribe the given |sender_id| from the push messaging service. The |
| 76 // subscription will be synchronously deactivated locally, and asynchronously | 79 // subscription will be synchronously deactivated locally, and asynchronously |
| 77 // sent to the push service, with automatic retry. | 80 // sent to the push service, with automatic retry. |
| 78 virtual void Unsubscribe(const GURL& requesting_origin, | 81 virtual void Unsubscribe(const GURL& requesting_origin, |
| 79 int64_t service_worker_registration_id, | 82 int64_t service_worker_registration_id, |
| 80 const std::string& sender_id, | 83 const std::string& sender_id, |
| 81 const UnregisterCallback& callback) = 0; | 84 const UnregisterCallback& callback) = 0; |
| 82 | 85 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 const GURL& origin, | 100 const GURL& origin, |
| 98 int64_t service_worker_registration_id, | 101 int64_t service_worker_registration_id, |
| 99 const StringCallback& callback); | 102 const StringCallback& callback); |
| 100 | 103 |
| 101 // Clear the push subscription id stored in the service worker with the given | 104 // Clear the push subscription id stored in the service worker with the given |
| 102 // |service_worker_registration_id| for the given |origin|. | 105 // |service_worker_registration_id| for the given |origin|. |
| 103 static void ClearPushSubscriptionID(BrowserContext* browser_context, | 106 static void ClearPushSubscriptionID(BrowserContext* browser_context, |
| 104 const GURL& origin, | 107 const GURL& origin, |
| 105 int64_t service_worker_registration_id, | 108 int64_t service_worker_registration_id, |
| 106 const base::Closure& callback); | 109 const base::Closure& callback); |
| 110 |
| 111 // Stores a push subscription in the service worker for the given |origin|. |
| 112 // Must only be used by tests. |
| 113 static void StorePushSubscriptionForTesting( |
| 114 BrowserContext* browser_context, |
| 115 const GURL& origin, |
| 116 int64_t service_worker_registration_id, |
| 117 const std::string& subscription_id, |
| 118 const std::string& sender_id, |
| 119 const base::Closure& callback); |
| 107 }; | 120 }; |
| 108 | 121 |
| 109 } // namespace content | 122 } // namespace content |
| 110 | 123 |
| 111 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 124 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
| OLD | NEW |