| Index: third_party/WebKit/public/platform/WebWorkerFetchContext.h
|
| diff --git a/third_party/WebKit/public/platform/WebWorkerFetchContext.h b/third_party/WebKit/public/platform/WebWorkerFetchContext.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b4895a5eb48dbea7900fe051c80b8baebc799918
|
| --- /dev/null
|
| +++ b/third_party/WebKit/public/platform/WebWorkerFetchContext.h
|
| @@ -0,0 +1,53 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef WebWorkerFetchContext_h
|
| +#define WebWorkerFetchContext_h
|
| +
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +} // namespace base
|
| +
|
| +namespace blink {
|
| +
|
| +class WebURL;
|
| +class WebURLLoader;
|
| +class WebURLRequest;
|
| +
|
| +// WebWorkerFetchContext is a per-worker object created on the main thread,
|
| +// passed to a worker (dedicated, shared and service worker) and initialized on
|
| +// the worker thread by InitializeOnWorkerThread(). It contains information
|
| +// about the resource fetching context (ex: service worker provider id), and is
|
| +// used to create a new WebURLLoader instance in the worker thread.
|
| +class WebWorkerFetchContext {
|
| + public:
|
| + virtual ~WebWorkerFetchContext() {}
|
| +
|
| + virtual void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) = 0;
|
| +
|
| + // Returns a new WebURLLoader instance which is associated with the worker
|
| + // thread.
|
| + virtual WebURLLoader* CreateURLLoader() = 0;
|
| +
|
| + // Called when a request is about to be sent out to modify the request to
|
| + // handle the request correctly in the loading stack later. (Example: service
|
| + // worker)
|
| + virtual void WillSendRequest(WebURLRequest&) = 0;
|
| +
|
| + // Whether the fetch context is controlled by a service worker.
|
| + virtual bool IsControlledByServiceWorker() const = 0;
|
| + virtual int64_t ServiceWorkerID() const { return 0; };
|
| + virtual void DidRunContentWithCertificateErrors(const WebURL& url) {}
|
| + virtual void DidDisplayContentWithCertificateErrors(const WebURL& url) {}
|
| +
|
| + // Set the information about the resource fetching context. Must be called on
|
| + // the main thread.
|
| + virtual void SetAppCacheHostID(int id) {}
|
| + virtual void SetDataSaverEnabled(bool flag) {}
|
| + virtual void SetStrictMixedContentCheckingEnabled(bool enabled) {}
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // WebWorkerFetchContext_h
|
|
|