| Index: content/browser/loader/resource_requester_info.h
|
| diff --git a/content/browser/loader/resource_requester_info.h b/content/browser/loader/resource_requester_info.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2ea742da05afdc1e1c769cf4b3a170d730dc0842
|
| --- /dev/null
|
| +++ b/content/browser/loader/resource_requester_info.h
|
| @@ -0,0 +1,106 @@
|
| +// Copyright 2016 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 CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
|
| +#define CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
|
| +
|
| +#include <memory>
|
| +
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "content/common/content_export.h"
|
| +#include "content/public/common/resource_type.h"
|
| +
|
| +namespace net {
|
| +class URLRequestContext;
|
| +} // namespace net
|
| +
|
| +namespace storage {
|
| +class FileSystemContext;
|
| +} // namespace storage
|
| +
|
| +namespace content {
|
| +class BrowserMessageFilter;
|
| +class ChromeAppCacheService;
|
| +class ChromeBlobStorageContext;
|
| +class ResourceContext;
|
| +class ResourceMessageFilter;
|
| +class ServiceWorkerContextWrapper;
|
| +
|
| +// This class represents the type of resource request.
|
| +// Currently there are three types:
|
| +// - Resource request from renderer processes.
|
| +// - Resource request for browser side navigation. (PlzNavigate).
|
| +// - Download request or page save request.
|
| +class CONTENT_EXPORT ResourceRequesterInfo {
|
| + public:
|
| + // Creates a ResourceRequesterInfo for renderer process initiated request.
|
| + // |filter| can't be null.
|
| + static std::unique_ptr<ResourceRequesterInfo> CreateForRenderer(
|
| + ResourceMessageFilter* filter);
|
| +
|
| + // Creates a ResourceRequesterInfo for a renderer process initiated request
|
| + // without ResourceMessageFilter for unittests.
|
| + static std::unique_ptr<ResourceRequesterInfo> CreateForRendererTesting(
|
| + int child_id);
|
| +
|
| + // Creates a ResourceRequesterInfo for a browser side navigation request which
|
| + // is initiated by the browser process.
|
| + static std::unique_ptr<ResourceRequesterInfo> CreateForBrowserSideNavigation(
|
| + scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
|
| +
|
| + // Creates a ResourceRequesterInfo for a download or page save request.
|
| + static std::unique_ptr<ResourceRequesterInfo> CreateForDownloadOrPageSave(
|
| + int child_id);
|
| +
|
| + virtual ~ResourceRequesterInfo() {}
|
| +
|
| + virtual std::unique_ptr<ResourceRequesterInfo> clone() const = 0;
|
| +
|
| + virtual bool IsRenderer() const = 0;
|
| + virtual bool IsBrowserSideNavigation() const = 0;
|
| +
|
| + // Returns the renderer process ID associated with the request. Returns -1 for
|
| + // browser side navigation requests. Even if the ResourceMessageFilter has
|
| + // been destroyed, this method of renderer type request info returns the
|
| + // valid process ID which was assigned to the renderer process of the filter.
|
| + virtual int GetChildID() const = 0;
|
| +
|
| + // Returns the filter for sending IPC messages to the renderer process. This
|
| + // may return null if the process eixted. This method is available only for
|
| + // renderer requests.
|
| + virtual BrowserMessageFilter* GetFilter() const = 0;
|
| +
|
| + // Returns the ResourceContext and URLRequestContext associated to the
|
| + // request. Currently this method is available only for renderer requests.
|
| + // The caller must check if the filter is still valid by calling GetFilter()
|
| + // in advance.
|
| + virtual void GetContexts(ResourceType resource_type,
|
| + ResourceContext** resource_context,
|
| + net::URLRequestContext** request_context) const = 0;
|
| +
|
| + // Returns the ChromeAppCacheService associated with the request. Currently
|
| + // this method is available only for renderer requests. The caller must check
|
| + // if the filter is still valid by calling GetFilter() in advance.
|
| + virtual ChromeAppCacheService* appcache_service() const = 0;
|
| +
|
| + // Returns the ChromeBlobStorageContext associated with the request. Currently
|
| + // this method is available only for renderer requests. The caller must check
|
| + // if the filter is still valid by calling GetFilter() in advance.
|
| + virtual ChromeBlobStorageContext* blob_storage_context() const = 0;
|
| +
|
| + // Returns the FileSystemContext associated with the request. Currently this
|
| + // method is available only for renderer requests. The caller must check
|
| + // if the filter is still valid by calling GetFilter() in advance.
|
| + virtual storage::FileSystemContext* file_system_context() const = 0;
|
| +
|
| + // Returns the ServiceWorkerContext associated with the request. Currently
|
| + // this method is available for renderer requests and browser side navigation
|
| + // requests. For renderer requests, the caller must check if the filter is
|
| + // still valid by calling GetFilter() in advance.
|
| + virtual ServiceWorkerContextWrapper* service_worker_context() const = 0;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
|
|
|