| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // shut the worker down while embedder is expecting the worker to be kept | 100 // shut the worker down while embedder is expecting the worker to be kept |
| 101 // alive. | 101 // alive. |
| 102 // | 102 // |
| 103 // Must be called from the IO thread. Returns whether or not changing the ref | 103 // Must be called from the IO thread. Returns whether or not changing the ref |
| 104 // count succeeded. | 104 // count succeeded. |
| 105 virtual bool StartingExternalRequest(int64_t service_worker_version_id, | 105 virtual bool StartingExternalRequest(int64_t service_worker_version_id, |
| 106 const std::string& request_uuid) = 0; | 106 const std::string& request_uuid) = 0; |
| 107 virtual bool FinishedExternalRequest(int64_t service_worker_version_id, | 107 virtual bool FinishedExternalRequest(int64_t service_worker_version_id, |
| 108 const std::string& request_uuid) = 0; | 108 const std::string& request_uuid) = 0; |
| 109 | 109 |
| 110 // Starts a previously registered worker at |origin| and returns running |
| 111 // worker info via |info_callback|. |
| 112 // Returned info contains worker render process id and worker thread id. |
| 113 // Must be called on IO thread. |
| 114 virtual void GetWorkerInfoAfterStartWorker( |
| 115 const GURL& origin, |
| 116 base::OnceCallback<void(int, int)> info_callback, |
| 117 base::OnceCallback<void()> failure_callback) = 0; |
| 118 |
| 110 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a | 119 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a |
| 111 // renderer, except that |pattern| is an absolute URL instead of relative to | 120 // renderer, except that |pattern| is an absolute URL instead of relative to |
| 112 // some current origin. |callback| is passed true when the JS promise is | 121 // some current origin. |callback| is passed true when the JS promise is |
| 113 // fulfilled or false when the JS promise is rejected. | 122 // fulfilled or false when the JS promise is rejected. |
| 114 // | 123 // |
| 115 // Unregistration can fail if: | 124 // Unregistration can fail if: |
| 116 // * No Service Worker was registered for |pattern|. | 125 // * No Service Worker was registered for |pattern|. |
| 117 // * Something unexpected goes wrong, like a renderer crash. | 126 // * Something unexpected goes wrong, like a renderer crash. |
| 118 // | 127 // |
| 119 // This function can be called from any thread, but the callback will always | 128 // This function can be called from any thread, but the callback will always |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 const StartServiceWorkerForNavigationHintCallback& callback) = 0; | 183 const StartServiceWorkerForNavigationHintCallback& callback) = 0; |
| 175 | 184 |
| 176 protected: | 185 protected: |
| 177 ServiceWorkerContext() {} | 186 ServiceWorkerContext() {} |
| 178 virtual ~ServiceWorkerContext() {} | 187 virtual ~ServiceWorkerContext() {} |
| 179 }; | 188 }; |
| 180 | 189 |
| 181 } // namespace content | 190 } // namespace content |
| 182 | 191 |
| 183 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 192 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |