Chromium Code Reviews| Index: third_party/WebKit/Source/core/loader/BaseFetchContext.h |
| diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContext.h b/third_party/WebKit/Source/core/loader/BaseFetchContext.h |
| index 724233fe0889a45a15068b84a4c8d0485db64661..de67282f0ae34f5bbdd2684e7607574cddc8937b 100644 |
| --- a/third_party/WebKit/Source/core/loader/BaseFetchContext.h |
| +++ b/third_party/WebKit/Source/core/loader/BaseFetchContext.h |
| @@ -6,13 +6,21 @@ |
| #define BaseFetchContext_h |
| #include "core/CoreExport.h" |
| -#include "core/dom/ExecutionContext.h" |
| +#include "core/frame/UseCounter.h" |
| #include "platform/heap/Handle.h" |
| #include "platform/loader/fetch/FetchContext.h" |
| #include "platform/loader/fetch/ResourceRequest.h" |
| namespace blink { |
| +class ContentSettingsClient; |
| +class ExecutionContext; |
| +class SecurityContext; |
| +class Settings; |
| +class SubresourceFilter; |
| + |
| +// A core-level implementaiton of FetchContext that does not depend on |
| +// Frame. This class provides basic default implementation for some methods. |
| class CORE_EXPORT BaseFetchContext : public FetchContext { |
| public: |
| explicit BaseFetchContext(ExecutionContext*); |
| @@ -20,14 +28,61 @@ class CORE_EXPORT BaseFetchContext : public FetchContext { |
| void AddAdditionalRequestHeaders(ResourceRequest&, |
| FetchResourceType) override; |
| + ResourceRequestBlockedReason CanRequest( |
| + Resource::Type, |
| + const ResourceRequest&, |
| + const KURL&, |
| + const ResourceLoaderOptions&, |
| + SecurityViolationReportingPolicy, |
| + FetchParameters::OriginRestriction) const override; |
| + ResourceRequestBlockedReason AllowResponse( |
| + Resource::Type, |
| + const ResourceRequest&, |
| + const KURL&, |
| + const ResourceLoaderOptions&) const override; |
| SecurityOrigin* GetSecurityOrigin() const override; |
| DECLARE_VIRTUAL_TRACE(); |
| protected: |
| + // Used for security checks. It is valid that they return nullptr, |
| + // while returning nullptr may result in disable some security checks. |
| + virtual ContentSettingsClient* GetContentSettingsClient() const = 0; |
| + virtual Settings* GetSettings() const = 0; |
| + virtual SubresourceFilter* GetSubresourceFilter() const = 0; |
| + virtual SecurityContext* GetMainResourceSecurityContext() const = 0; |
| + |
| + // Note: subclasses are expected to override following methods. |
| + // Used in the default implementation for CanRequest() and AllowResponse(). |
| + virtual bool ShouldBlockRequestByInspector(const ResourceRequest&) const = 0; |
| + virtual void DispatchDidBlockRequest(const ResourceRequest&, |
| + const FetchInitiatorInfo&, |
| + ResourceRequestBlockedReason) const = 0; |
| + virtual void ReportLocalLoadFailed(const KURL&) const = 0; |
| + virtual bool ShouldBypassMainWorldCSP() const = 0; |
| + virtual bool IsSVGImageChromeClient() const = 0; |
| + virtual void CountUsage(UseCounter::Feature) const = 0; |
|
horo
2017/04/19 11:38:39
Why don't you directly call CountUsage(execution_c
kinuko
2017/04/20 02:33:22
This one's a bit tricky, GetFrame()->GetDocument()
horo
2017/04/20 06:00:48
Ah, I got it.
|
| + virtual void CountDeprecation(UseCounter::Feature) const = 0; |
|
horo
2017/04/19 11:38:39
same as CountUsage.
|
| + virtual bool ShouldBlockFetchByMixedContentCheck( |
| + const ResourceRequest&, |
| + const KURL&, |
| + SecurityViolationReportingPolicy) const = 0; |
| + |
| + // Utility method that can be used to implement other methods. |
| void PrintAccessDeniedMessage(const KURL&) const; |
| void AddCSPHeaderIfNecessary(Resource::Type, ResourceRequest&); |
| + // Utility method that is used in default implement for CanRequest and |
| + // AllowResponse. |
| + ResourceRequestBlockedReason CanRequestInternal( |
| + Resource::Type, |
| + const ResourceRequest&, |
| + const KURL&, |
| + const ResourceLoaderOptions&, |
| + SecurityViolationReportingPolicy, |
| + FetchParameters::OriginRestriction, |
| + ResourceRequest::RedirectStatus) const; |
| + |
| // FIXME: Oilpan: Ideally this should just be a traced Member but that will |
| // currently leak because ComputedStyle and its data are not on the heap. |
| // See crbug.com/383860 for details. |