| 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 blink { | |
| 16 enum class WebNavigationHintType; | |
| 17 } | |
| 18 | |
| 19 namespace content { | 15 namespace content { |
| 20 | 16 |
| 21 enum class ServiceWorkerCapability { | 17 enum class ServiceWorkerCapability { |
| 22 NO_SERVICE_WORKER, | 18 NO_SERVICE_WORKER, |
| 23 SERVICE_WORKER_NO_FETCH_HANDLER, | 19 SERVICE_WORKER_NO_FETCH_HANDLER, |
| 24 SERVICE_WORKER_WITH_FETCH_HANDLER, | 20 SERVICE_WORKER_WITH_FETCH_HANDLER, |
| 25 }; | 21 }; |
| 26 | 22 |
| 27 // Represents the per-StoragePartition ServiceWorker data. | 23 // Represents the per-StoragePartition ServiceWorker data. |
| 28 class ServiceWorkerContext { | 24 class ServiceWorkerContext { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; | 132 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; |
| 137 | 133 |
| 138 // Stops all running service workers and unregisters all service worker | 134 // Stops all running service workers and unregisters all service worker |
| 139 // 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 |
| 140 // existing service worker will not affect the succeeding tests. | 136 // existing service worker will not affect the succeeding tests. |
| 141 // | 137 // |
| 142 // 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 |
| 143 // be called on the UI thread. | 139 // be called on the UI thread. |
| 144 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; | 140 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; |
| 145 | 141 |
| 146 // Starts a Service Worker for |document_url| for a navigation hint in the | |
| 147 // specified render process |render_process_id|. Must be called from the UI | |
| 148 // thread. The |callback| will always be called on the UI thread. | |
| 149 // This method can fail if: | |
| 150 // * No Service Worker was registered for |document_url|. | |
| 151 // * The specified render process is not suitable for loading |document_url|. | |
| 152 virtual void StartServiceWorkerForNavigationHint( | |
| 153 const GURL& document_url, | |
| 154 blink::WebNavigationHintType type, | |
| 155 int render_process_id, | |
| 156 const ResultCallback& callback) = 0; | |
| 157 | |
| 158 protected: | 142 protected: |
| 159 ServiceWorkerContext() {} | 143 ServiceWorkerContext() {} |
| 160 virtual ~ServiceWorkerContext() {} | 144 virtual ~ServiceWorkerContext() {} |
| 161 }; | 145 }; |
| 162 | 146 |
| 163 } // namespace content | 147 } // namespace content |
| 164 | 148 |
| 165 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 149 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |