Chromium Code Reviews| 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_SERVICE_WORKER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // specified |origin| via |callback|. | 118 // specified |origin| via |callback|. |
| 119 virtual void CountExternalRequestsForTest( | 119 virtual void CountExternalRequestsForTest( |
| 120 const GURL& origin, | 120 const GURL& origin, |
| 121 const CountExternalRequestsCallback& callback) = 0; | 121 const CountExternalRequestsCallback& callback) = 0; |
| 122 | 122 |
| 123 // Stops all running workers on the given |origin|. | 123 // Stops all running workers on the given |origin|. |
| 124 // | 124 // |
| 125 // This function can be called from any thread. | 125 // This function can be called from any thread. |
| 126 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; | 126 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; |
| 127 | 127 |
| 128 // As above, but |callback| is executed for each running worker stopped, or if | |
|
falken
2017/01/06 16:17:55
nit: This comment no longer matches the latest pat
mattcary
2017/01/09 14:45:42
Moot
| |
| 129 // there are no running workers to stop. The callback will run on the IO | |
| 130 // thread. | |
| 131 virtual void StopAllServiceWorkersForOriginWithCallback( | |
| 132 const GURL& origin, | |
| 133 const base::Closure& callback) = 0; | |
| 134 | |
| 128 // Stops all running service workers and unregisters all service worker | 135 // Stops all running service workers and unregisters all service worker |
| 129 // registrations. This method is used in LayoutTests to make sure that the | 136 // registrations. This method is used in LayoutTests to make sure that the |
| 130 // existing service worker will not affect the succeeding tests. | 137 // existing service worker will not affect the succeeding tests. |
| 131 // | 138 // |
| 132 // This function can be called from any thread, but the callback will always | 139 // This function can be called from any thread, but the callback will always |
| 133 // be called on the UI thread. | 140 // be called on the UI thread. |
| 134 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; | 141 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; |
| 135 | 142 |
| 136 // Starts a Service Worker for |document_url| for a navigation hint in the | 143 // Starts a Service Worker for |document_url| for a navigation hint in the |
| 137 // specified render process |render_process_id|. Must be called from the UI | 144 // specified render process |render_process_id|. Must be called from the UI |
| 138 // thread. The |callback| will always be called on the UI thread. | 145 // thread. The |callback| will always be called on the UI thread. |
| 139 // This method can fail if: | 146 // This method can fail if: |
| 140 // * No Service Worker was registered for |document_url|. | 147 // * No Service Worker was registered for |document_url|. |
| 141 // * The specified render process is not suitable for loading |document_url|. | 148 // * The specified render process is not suitable for loading |document_url|. |
| 142 virtual void StartServiceWorkerForNavigationHint( | 149 virtual void StartServiceWorkerForNavigationHint( |
| 143 const GURL& document_url, | 150 const GURL& document_url, |
| 144 blink::WebNavigationHintType type, | 151 blink::WebNavigationHintType type, |
| 145 int render_process_id, | 152 int render_process_id, |
| 146 const ResultCallback& callback) = 0; | 153 const ResultCallback& callback) = 0; |
| 147 | 154 |
| 148 protected: | 155 protected: |
| 149 ServiceWorkerContext() {} | 156 ServiceWorkerContext() {} |
| 150 virtual ~ServiceWorkerContext() {} | 157 virtual ~ServiceWorkerContext() {} |
| 151 }; | 158 }; |
| 152 | 159 |
| 153 } // namespace content | 160 } // namespace content |
| 154 | 161 |
| 155 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 162 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |