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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 using CheckHasServiceWorkerCallback = | 52 using CheckHasServiceWorkerCallback = |
| 53 base::Callback<void(ServiceWorkerCapability capability)>; | 53 base::Callback<void(ServiceWorkerCapability capability)>; |
| 54 | 54 |
| 55 using CountExternalRequestsCallback = | 55 using CountExternalRequestsCallback = |
| 56 base::Callback<void(size_t external_request_count)>; | 56 base::Callback<void(size_t external_request_count)>; |
| 57 | 57 |
| 58 using StartServiceWorkerForNavigationHintCallback = | 58 using StartServiceWorkerForNavigationHintCallback = |
| 59 base::Callback<void(StartServiceWorkerForNavigationHintResult result)>; | 59 base::Callback<void(StartServiceWorkerForNavigationHintResult result)>; |
| 60 | 60 |
| 61 using GetWorkerInfoCallback = | |
| 62 base::OnceCallback<void(int process_id, int thread_id)>; | |
| 63 | |
| 61 // Registers the header name which should not be passed to the ServiceWorker. | 64 // Registers the header name which should not be passed to the ServiceWorker. |
| 62 // Must be called from the IO thread. | 65 // Must be called from the IO thread. |
| 63 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent( | 66 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent( |
| 64 const std::set<std::string>& header_names); | 67 const std::set<std::string>& header_names); |
| 65 | 68 |
| 66 // Returns true if the header name should not be passed to the ServiceWorker. | 69 // Returns true if the header name should not be passed to the ServiceWorker. |
| 67 // Must be called from the IO thread. | 70 // Must be called from the IO thread. |
| 68 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name); | 71 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name); |
| 69 | 72 |
| 70 // Returns true if |url| is within the service worker |scope|. | 73 // Returns true if |url| is within the service worker |scope|. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 100 // shut the worker down while embedder is expecting the worker to be kept | 103 // shut the worker down while embedder is expecting the worker to be kept |
| 101 // alive. | 104 // alive. |
| 102 // | 105 // |
| 103 // Must be called from the IO thread. Returns whether or not changing the ref | 106 // Must be called from the IO thread. Returns whether or not changing the ref |
| 104 // count succeeded. | 107 // count succeeded. |
| 105 virtual bool StartingExternalRequest(int64_t service_worker_version_id, | 108 virtual bool StartingExternalRequest(int64_t service_worker_version_id, |
| 106 const std::string& request_uuid) = 0; | 109 const std::string& request_uuid) = 0; |
| 107 virtual bool FinishedExternalRequest(int64_t service_worker_version_id, | 110 virtual bool FinishedExternalRequest(int64_t service_worker_version_id, |
| 108 const std::string& request_uuid) = 0; | 111 const std::string& request_uuid) = 0; |
| 109 | 112 |
| 113 // Starts a previously registered worker at |origin| and returns running | |
|
falken
2017/06/22 03:35:57
Starts the active worker of the registration whose
lazyboy
2017/06/23 02:18:30
Done.
| |
| 114 // worker info via |info_callback|. | |
| 115 // |info_callback| contains worker render process id and worker thread id. | |
|
falken
2017/06/22 03:35:57
Is "contains" the conventional wording for a callb
lazyboy
2017/06/23 02:18:30
That's better, thanks.
Done.
| |
| 116 // | |
| 117 // Must be called on IO thread. | |
| 118 virtual void GetWorkerInfoAfterStartWorker( | |
| 119 const GURL& origin, | |
|
falken
2017/06/22 03:35:57
|origin| looks weird to me because an origin can h
lazyboy
2017/06/23 02:18:30
It is origin + scope,
For example,
chrome-extensio
| |
| 120 GetWorkerInfoCallback info_callback, | |
| 121 base::OnceClosure failure_callback) = 0; | |
| 122 | |
| 110 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a | 123 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a |
| 111 // renderer, except that |pattern| is an absolute URL instead of relative to | 124 // 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 | 125 // some current origin. |callback| is passed true when the JS promise is |
| 113 // fulfilled or false when the JS promise is rejected. | 126 // fulfilled or false when the JS promise is rejected. |
| 114 // | 127 // |
| 115 // Unregistration can fail if: | 128 // Unregistration can fail if: |
| 116 // * No Service Worker was registered for |pattern|. | 129 // * No Service Worker was registered for |pattern|. |
| 117 // * Something unexpected goes wrong, like a renderer crash. | 130 // * Something unexpected goes wrong, like a renderer crash. |
| 118 // | 131 // |
| 119 // This function can be called from any thread, but the callback will always | 132 // 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; | 187 const StartServiceWorkerForNavigationHintCallback& callback) = 0; |
| 175 | 188 |
| 176 protected: | 189 protected: |
| 177 ServiceWorkerContext() {} | 190 ServiceWorkerContext() {} |
| 178 virtual ~ServiceWorkerContext() {} | 191 virtual ~ServiceWorkerContext() {} |
| 179 }; | 192 }; |
| 180 | 193 |
| 181 } // namespace content | 194 } // namespace content |
| 182 | 195 |
| 183 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 196 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |