OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebWorkerFetchContext_h |
| 6 #define WebWorkerFetchContext_h |
| 7 |
| 8 namespace base { |
| 9 class SingleThreadTaskRunner; |
| 10 } // namespace base |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class WebURL; |
| 15 class WebURLLoader; |
| 16 class WebURLRequest; |
| 17 |
| 18 // WebWorkerFetchContext is a per-worker object created on the main thread, |
| 19 // passed to a worker (dedicated, shared and service worker) and initialized on |
| 20 // the worker thread by InitializeOnWorkerThread(). It contains information |
| 21 // about the resource fetching context (ex: service worker provider id), and is |
| 22 // used to create a new WebURLLoader instance in the worker thread. |
| 23 class WebWorkerFetchContext { |
| 24 public: |
| 25 virtual ~WebWorkerFetchContext() {} |
| 26 |
| 27 virtual void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) = 0; |
| 28 |
| 29 // Returns a new WebURLLoader instance which is associated with the worker |
| 30 // thread. |
| 31 virtual WebURLLoader* CreateURLLoader() = 0; |
| 32 |
| 33 // Called when a request is about to be sent out to modify the request to |
| 34 // handle the request correctly in the loading stack later. (Example: service |
| 35 // worker) |
| 36 virtual void WillSendRequest(WebURLRequest&) = 0; |
| 37 |
| 38 // Whether the fetch context is controlled by a service worker. |
| 39 virtual bool IsControlledByServiceWorker() const = 0; |
| 40 virtual int64_t ServiceWorkerID() const { return 0; }; |
| 41 virtual void DidRunContentWithCertificateErrors(const WebURL& url) {} |
| 42 virtual void DidDisplayContentWithCertificateErrors(const WebURL& url) {} |
| 43 |
| 44 // Set the information about the resource fetching context. Must be called on |
| 45 // the main thread. |
| 46 virtual void SetAppCacheHostID(int id) {} |
| 47 virtual void SetDataSaverEnabled(bool flag) {} |
| 48 virtual void SetStrictMixedContentCheckingEnabled(bool enabled) {} |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif // WebWorkerFetchContext_h |
OLD | NEW |