Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/FetchContext.h

Issue 2747203002: Make prepareRequest() a separate callback of FetchContext (Closed)
Patch Set: addressed comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // a const reference as a header needs to be added for doc.write blocking 82 // a const reference as a header needs to be added for doc.write blocking
83 // intervention. 83 // intervention.
84 virtual WebCachePolicy resourceRequestCachePolicy( 84 virtual WebCachePolicy resourceRequestCachePolicy(
85 ResourceRequest&, 85 ResourceRequest&,
86 Resource::Type, 86 Resource::Type,
87 FetchRequest::DeferOption) const; 87 FetchRequest::DeferOption) const;
88 88
89 virtual void dispatchDidChangeResourcePriority(unsigned long identifier, 89 virtual void dispatchDidChangeResourcePriority(unsigned long identifier,
90 ResourceLoadPriority, 90 ResourceLoadPriority,
91 int intraPriorityValue); 91 int intraPriorityValue);
92
93 // This internally dispatches WebFrameClient::willSendRequest and hooks
94 // request interceptors like ServiceWorker and ApplicationCache.
95 // This may modify the request.
96 enum class RedirectType { kForRedirect, kNotForRedirect };
97 virtual void prepareRequest(ResourceRequest&, RedirectType);
98
92 // The last callback before a request is actually sent to the browser process. 99 // The last callback before a request is actually sent to the browser process.
100 // TODO(https://crbug.com/632580): make this take const ResourceRequest&.
93 virtual void dispatchWillSendRequest( 101 virtual void dispatchWillSendRequest(
94 unsigned long identifier, 102 unsigned long identifier,
95 ResourceRequest&, 103 ResourceRequest&,
96 const ResourceResponse& redirectResponse, 104 const ResourceResponse& redirectResponse,
97 const FetchInitiatorInfo& = FetchInitiatorInfo()); 105 const FetchInitiatorInfo& = FetchInitiatorInfo());
106
98 virtual void dispatchDidLoadResourceFromMemoryCache( 107 virtual void dispatchDidLoadResourceFromMemoryCache(
99 unsigned long identifier, 108 unsigned long identifier,
100 Resource*, 109 Resource*,
101 WebURLRequest::FrameType, 110 WebURLRequest::FrameType,
102 WebURLRequest::RequestContext); 111 WebURLRequest::RequestContext);
103 virtual void dispatchDidReceiveResponse(unsigned long identifier, 112 virtual void dispatchDidReceiveResponse(unsigned long identifier,
104 const ResourceResponse&, 113 const ResourceResponse&,
105 WebURLRequest::FrameType, 114 WebURLRequest::FrameType,
106 WebURLRequest::RequestContext, 115 WebURLRequest::RequestContext,
107 Resource*); 116 Resource*);
108 virtual void dispatchDidReceiveData(unsigned long identifier, 117 virtual void dispatchDidReceiveData(unsigned long identifier,
109 const char* data, 118 const char* data,
110 int dataLength); 119 int dataLength);
111 virtual void dispatchDidReceiveEncodedData(unsigned long identifier, 120 virtual void dispatchDidReceiveEncodedData(unsigned long identifier,
112 int encodedDataLength); 121 int encodedDataLength);
113 virtual void dispatchDidDownloadData(unsigned long identifier, 122 virtual void dispatchDidDownloadData(unsigned long identifier,
114 int dataLength, 123 int dataLength,
115 int encodedDataLength); 124 int encodedDataLength);
116 virtual void dispatchDidFinishLoading(unsigned long identifier, 125 virtual void dispatchDidFinishLoading(unsigned long identifier,
117 double finishTime, 126 double finishTime,
118 int64_t encodedDataLength, 127 int64_t encodedDataLength,
119 int64_t decodedBodyLength); 128 int64_t decodedBodyLength);
120 virtual void dispatchDidFail(unsigned long identifier, 129 virtual void dispatchDidFail(unsigned long identifier,
121 const ResourceError&, 130 const ResourceError&,
122 int64_t encodedDataLength, 131 int64_t encodedDataLength,
123 bool isInternalRequest); 132 bool isInternalRequest);
124 133
125 virtual bool shouldLoadNewResource(Resource::Type) const { return false; } 134 virtual bool shouldLoadNewResource(Resource::Type) const { return false; }
135
126 // Called when a resource load is first requested, which may not be when the 136 // Called when a resource load is first requested, which may not be when the
127 // load actually begins. 137 // load actually begins.
128 enum class V8ActivityLoggingPolicy { SuppressLogging, Log }; 138 virtual void recordLoadingActivity(unsigned long identifier,
129 virtual void willStartLoadingResource(unsigned long identifier, 139 const ResourceRequest&,
130 ResourceRequest&, 140 Resource::Type,
131 Resource::Type, 141 const AtomicString& fetchInitiatorName);
132 const AtomicString& fetchInitiatorName, 142
133 V8ActivityLoggingPolicy);
134 virtual void didLoadResource(Resource*); 143 virtual void didLoadResource(Resource*);
135 144
136 virtual void addResourceTiming(const ResourceTimingInfo&); 145 virtual void addResourceTiming(const ResourceTimingInfo&);
137 virtual bool allowImage(bool, const KURL&) const { return false; } 146 virtual bool allowImage(bool, const KURL&) const { return false; }
138 virtual ResourceRequestBlockedReason canRequest( 147 virtual ResourceRequestBlockedReason canRequest(
139 Resource::Type, 148 Resource::Type,
140 const ResourceRequest&, 149 const ResourceRequest&,
141 const KURL&, 150 const KURL&,
142 const ResourceLoaderOptions&, 151 const ResourceLoaderOptions&,
143 SecurityViolationReportingPolicy, 152 SecurityViolationReportingPolicy,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 196
188 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; } 197 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; }
189 198
190 protected: 199 protected:
191 FetchContext() {} 200 FetchContext() {}
192 }; 201 };
193 202
194 } // namespace blink 203 } // namespace blink
195 204
196 #endif 205 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698