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 when a running worker is stopped. If | |
| 129 // there is no running worker, |callback| will never be executed. | |
|
horo
2017/01/05 05:33:58
Please write comment that the |callback| is execut
mattcary
2017/01/05 14:30:43
Done.
Note that the RunSoon helper defined in ser
horo
2017/01/06 02:27:41
The |callback| should be called only once when the
mattcary
2017/01/06 15:21:22
Ah, I misunderstood. That's a good idea, done.
| |
| 130 virtual void StopAllServiceWorkersForOriginWithCallback( | |
| 131 const GURL& origin, | |
| 132 const base::Closure& callback) = 0; | |
| 133 | |
| 128 // Stops all running service workers and unregisters all service worker | 134 // Stops all running service workers and unregisters all service worker |
| 129 // registrations. This method is used in LayoutTests to make sure that the | 135 // registrations. This method is used in LayoutTests to make sure that the |
| 130 // existing service worker will not affect the succeeding tests. | 136 // existing service worker will not affect the succeeding tests. |
| 131 // | 137 // |
| 132 // This function can be called from any thread, but the callback will always | 138 // This function can be called from any thread, but the callback will always |
| 133 // be called on the UI thread. | 139 // be called on the UI thread. |
| 134 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; | 140 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; |
| 135 | 141 |
| 136 // Starts a Service Worker for |document_url| for a navigation hint in the | 142 // 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 | 143 // specified render process |render_process_id|. Must be called from the UI |
| 138 // thread. The |callback| will always be called on the UI thread. | 144 // thread. The |callback| will always be called on the UI thread. |
| 139 // This method can fail if: | 145 // This method can fail if: |
| 140 // * No Service Worker was registered for |document_url|. | 146 // * No Service Worker was registered for |document_url|. |
| 141 // * The specified render process is not suitable for loading |document_url|. | 147 // * The specified render process is not suitable for loading |document_url|. |
| 142 virtual void StartServiceWorkerForNavigationHint( | 148 virtual void StartServiceWorkerForNavigationHint( |
| 143 const GURL& document_url, | 149 const GURL& document_url, |
| 144 blink::WebNavigationHintType type, | 150 blink::WebNavigationHintType type, |
| 145 int render_process_id, | 151 int render_process_id, |
| 146 const ResultCallback& callback) = 0; | 152 const ResultCallback& callback) = 0; |
| 147 | 153 |
| 148 protected: | 154 protected: |
| 149 ServiceWorkerContext() {} | 155 ServiceWorkerContext() {} |
| 150 virtual ~ServiceWorkerContext() {} | 156 virtual ~ServiceWorkerContext() {} |
| 151 }; | 157 }; |
| 152 | 158 |
| 153 } // namespace content | 159 } // namespace content |
| 154 | 160 |
| 155 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 161 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |