| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 BaseFetchContext_h | 5 #ifndef BaseFetchContext_h |
| 6 #define BaseFetchContext_h | 6 #define BaseFetchContext_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
| 10 #include "core/frame/csp/ContentSecurityPolicy.h" | 10 #include "core/frame/csp/ContentSecurityPolicy.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // A core-level implementaiton of FetchContext that does not depend on | 23 // A core-level implementaiton of FetchContext that does not depend on |
| 24 // Frame. This class provides basic default implementation for some methods. | 24 // Frame. This class provides basic default implementation for some methods. |
| 25 class CORE_EXPORT BaseFetchContext : public FetchContext { | 25 class CORE_EXPORT BaseFetchContext : public FetchContext { |
| 26 public: | 26 public: |
| 27 explicit BaseFetchContext(ExecutionContext*); | 27 explicit BaseFetchContext(ExecutionContext*); |
| 28 ~BaseFetchContext() override { execution_context_ = nullptr; } | 28 ~BaseFetchContext() override { execution_context_ = nullptr; } |
| 29 | 29 |
| 30 void AddAdditionalRequestHeaders(ResourceRequest&, | 30 void AddAdditionalRequestHeaders(ResourceRequest&, |
| 31 FetchResourceType) override; | 31 FetchResourceType) override; |
| 32 void DispatchDidReceiveEncodedData(unsigned long identifier, |
| 33 int encoded_data_length) override; |
| 32 ResourceRequestBlockedReason CanRequest( | 34 ResourceRequestBlockedReason CanRequest( |
| 33 Resource::Type, | 35 Resource::Type, |
| 34 const ResourceRequest&, | 36 const ResourceRequest&, |
| 35 const KURL&, | 37 const KURL&, |
| 36 const ResourceLoaderOptions&, | 38 const ResourceLoaderOptions&, |
| 37 SecurityViolationReportingPolicy, | 39 SecurityViolationReportingPolicy, |
| 38 FetchParameters::OriginRestriction) const override; | 40 FetchParameters::OriginRestriction) const override; |
| 39 ResourceRequestBlockedReason CanFollowRedirect( | 41 ResourceRequestBlockedReason CanFollowRedirect( |
| 40 Resource::Type, | 42 Resource::Type, |
| 41 const ResourceRequest&, | 43 const ResourceRequest&, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 // Used for security checks. It is valid that they return nullptr, | 58 // Used for security checks. It is valid that they return nullptr, |
| 57 // while returning nullptr may result in disable some security checks. | 59 // while returning nullptr may result in disable some security checks. |
| 58 virtual ContentSettingsClient* GetContentSettingsClient() const = 0; | 60 virtual ContentSettingsClient* GetContentSettingsClient() const = 0; |
| 59 virtual Settings* GetSettings() const = 0; | 61 virtual Settings* GetSettings() const = 0; |
| 60 virtual SubresourceFilter* GetSubresourceFilter() const = 0; | 62 virtual SubresourceFilter* GetSubresourceFilter() const = 0; |
| 61 virtual SecurityContext* GetParentSecurityContext() const = 0; | 63 virtual SecurityContext* GetParentSecurityContext() const = 0; |
| 62 | 64 |
| 63 // Note: subclasses are expected to override following methods. | 65 // Note: subclasses are expected to override following methods. |
| 64 // Used in the default implementation for CanRequest, CanFollowRedirect | 66 // Used in the default implementation for CanRequest, CanFollowRedirect |
| 65 // and AllowResponse. | 67 // and AllowResponse. |
| 66 virtual bool ShouldBlockRequestByInspector(const ResourceRequest&) const = 0; | |
| 67 virtual void DispatchDidBlockRequest(const ResourceRequest&, | 68 virtual void DispatchDidBlockRequest(const ResourceRequest&, |
| 68 const FetchInitiatorInfo&, | 69 const FetchInitiatorInfo&, |
| 69 ResourceRequestBlockedReason) const = 0; | 70 ResourceRequestBlockedReason) const = 0; |
| 70 // TODO(kinuko): Consider implementing this on ExecutionContext and | 71 // TODO(kinuko): Consider implementing this on ExecutionContext and |
| 71 // remove this virtual method. | 72 // remove this virtual method. |
| 72 virtual void ReportLocalLoadFailed(const KURL&) const = 0; | 73 virtual void ReportLocalLoadFailed(const KURL&) const = 0; |
| 73 virtual bool ShouldBypassMainWorldCSP() const = 0; | 74 virtual bool ShouldBypassMainWorldCSP() const = 0; |
| 74 virtual bool IsSVGImageChromeClient() const = 0; | 75 virtual bool IsSVGImageChromeClient() const = 0; |
| 75 virtual void CountUsage(UseCounter::Feature) const = 0; | 76 virtual void CountUsage(UseCounter::Feature) const = 0; |
| 76 virtual void CountDeprecation(UseCounter::Feature) const = 0; | 77 virtual void CountDeprecation(UseCounter::Feature) const = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 103 | 104 |
| 104 // FIXME: Oilpan: Ideally this should just be a traced Member but that will | 105 // FIXME: Oilpan: Ideally this should just be a traced Member but that will |
| 105 // currently leak because ComputedStyle and its data are not on the heap. | 106 // currently leak because ComputedStyle and its data are not on the heap. |
| 106 // See crbug.com/383860 for details. | 107 // See crbug.com/383860 for details. |
| 107 WeakMember<ExecutionContext> execution_context_; | 108 WeakMember<ExecutionContext> execution_context_; |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace blink | 111 } // namespace blink |
| 111 | 112 |
| 112 #endif // BaseFetchContext_h | 113 #endif // BaseFetchContext_h |
| OLD | NEW |