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 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "content/public/browser/service_worker_usage_info.h" | 12 #include "content/public/browser/service_worker_usage_info.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class RenderProcessHost; | |
| 18 | |
| 17 enum class ServiceWorkerCapability { | 19 enum class ServiceWorkerCapability { |
| 18 NO_SERVICE_WORKER, | 20 NO_SERVICE_WORKER, |
| 19 SERVICE_WORKER_NO_FETCH_HANDLER, | 21 SERVICE_WORKER_NO_FETCH_HANDLER, |
| 20 SERVICE_WORKER_WITH_FETCH_HANDLER, | 22 SERVICE_WORKER_WITH_FETCH_HANDLER, |
| 21 }; | 23 }; |
| 22 | 24 |
| 23 // Represents the per-StoragePartition ServiceWorker data. | 25 // Represents the per-StoragePartition ServiceWorker data. |
| 24 class ServiceWorkerContext { | 26 class ServiceWorkerContext { |
| 25 public: | 27 public: |
| 26 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: | 28 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; | 134 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; |
| 133 | 135 |
| 134 // Stops all running service workers and unregisters all service worker | 136 // Stops all running service workers and unregisters all service worker |
| 135 // registrations. This method is used in LayoutTests to make sure that the | 137 // registrations. This method is used in LayoutTests to make sure that the |
| 136 // existing service worker will not affect the succeeding tests. | 138 // existing service worker will not affect the succeeding tests. |
| 137 // | 139 // |
| 138 // This function can be called from any thread, but the callback will always | 140 // This function can be called from any thread, but the callback will always |
| 139 // be called on the UI thread. | 141 // be called on the UI thread. |
| 140 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; | 142 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; |
| 141 | 143 |
| 144 // Starts a Service Worker for |document_url| for a navigation preconnect in | |
| 145 // the specified render process |host|. Must be called from the UI thread. The | |
|
falken
2017/06/01 06:54:17
The "for... for... in..." is ambiguous: is the doc
horo
2017/06/01 11:15:07
I changed it to "StartServiceWorkerForNavigation".
falken
2017/06/01 23:24:14
Sorry I totally overlooked the EventType. I think
| |
| 146 // |callback| will always be called on the UI thread. This method can fail if: | |
| 147 // * No Service Worker was registered for |document_url|. | |
| 148 // * The specified render process is not suitable for loading |document_url|. | |
| 149 virtual void StartServiceWorkerForNavigationPreconnect( | |
| 150 const GURL& document_url, | |
| 151 RenderProcessHost* host, | |
| 152 const ResultCallback& callback) = 0; | |
| 153 | |
| 142 protected: | 154 protected: |
| 143 ServiceWorkerContext() {} | 155 ServiceWorkerContext() {} |
| 144 virtual ~ServiceWorkerContext() {} | 156 virtual ~ServiceWorkerContext() {} |
| 145 }; | 157 }; |
| 146 | 158 |
| 147 } // namespace content | 159 } // namespace content |
| 148 | 160 |
| 149 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 161 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |