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

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: . 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // a const reference as a header needs to be added for doc.write blocking 83 // a const reference as a header needs to be added for doc.write blocking
84 // intervention. 84 // intervention.
85 virtual WebCachePolicy resourceRequestCachePolicy( 85 virtual WebCachePolicy resourceRequestCachePolicy(
86 ResourceRequest&, 86 ResourceRequest&,
87 Resource::Type, 87 Resource::Type,
88 FetchRequest::DeferOption) const; 88 FetchRequest::DeferOption) const;
89 89
90 virtual void dispatchDidChangeResourcePriority(unsigned long identifier, 90 virtual void dispatchDidChangeResourcePriority(unsigned long identifier,
91 ResourceLoadPriority, 91 ResourceLoadPriority,
92 int intraPriorityValue); 92 int intraPriorityValue);
93
94 // This internally dispatches WebFrameClient::willSendRequest hook
kinuko 2017/03/15 04:49:19 'and' is missing before 'hook'
Nate Chapin 2017/03/22 19:12:59 Nit: 'hooks'
kinuko 2017/03/23 05:12:17 Done.
95 // request interceptors like ServiceWorker and ApplicationCache.
96 // This may modify the request.
97 enum class RedirectType { kForRedirect, kNotForRedirect };
98 virtual void prepareRequest(ResourceRequest&, RedirectType);
99
93 // The last callback before a request is actually sent to the browser process. 100 // The last callback before a request is actually sent to the browser process.
101 // TODO(https://crbug.com/632580): make this take const ResourceRequest&.
94 virtual void dispatchWillSendRequest( 102 virtual void dispatchWillSendRequest(
95 unsigned long identifier, 103 unsigned long identifier,
96 ResourceRequest&, 104 ResourceRequest&,
97 const ResourceResponse& redirectResponse, 105 const ResourceResponse& redirectResponse,
98 const FetchInitiatorInfo& = FetchInitiatorInfo()); 106 const FetchInitiatorInfo& = FetchInitiatorInfo());
107
99 virtual void dispatchDidLoadResourceFromMemoryCache( 108 virtual void dispatchDidLoadResourceFromMemoryCache(
100 unsigned long identifier, 109 unsigned long identifier,
101 Resource*, 110 Resource*,
102 WebURLRequest::FrameType, 111 WebURLRequest::FrameType,
103 WebURLRequest::RequestContext); 112 WebURLRequest::RequestContext);
104 virtual void dispatchDidReceiveResponse(unsigned long identifier, 113 virtual void dispatchDidReceiveResponse(unsigned long identifier,
105 const ResourceResponse&, 114 const ResourceResponse&,
106 WebURLRequest::FrameType, 115 WebURLRequest::FrameType,
107 WebURLRequest::RequestContext, 116 WebURLRequest::RequestContext,
108 Resource*); 117 Resource*);
109 virtual void dispatchDidReceiveData(unsigned long identifier, 118 virtual void dispatchDidReceiveData(unsigned long identifier,
110 const char* data, 119 const char* data,
111 int dataLength); 120 int dataLength);
112 virtual void dispatchDidReceiveEncodedData(unsigned long identifier, 121 virtual void dispatchDidReceiveEncodedData(unsigned long identifier,
113 int encodedDataLength); 122 int encodedDataLength);
114 virtual void dispatchDidDownloadData(unsigned long identifier, 123 virtual void dispatchDidDownloadData(unsigned long identifier,
115 int dataLength, 124 int dataLength,
116 int encodedDataLength); 125 int encodedDataLength);
117 virtual void dispatchDidFinishLoading(unsigned long identifier, 126 virtual void dispatchDidFinishLoading(unsigned long identifier,
118 double finishTime, 127 double finishTime,
119 int64_t encodedDataLength, 128 int64_t encodedDataLength,
120 int64_t decodedBodyLength); 129 int64_t decodedBodyLength);
121 virtual void dispatchDidFail(unsigned long identifier, 130 virtual void dispatchDidFail(unsigned long identifier,
122 const ResourceError&, 131 const ResourceError&,
123 int64_t encodedDataLength, 132 int64_t encodedDataLength,
124 bool isInternalRequest); 133 bool isInternalRequest);
125 134
126 virtual bool shouldLoadNewResource(Resource::Type) const { return false; } 135 virtual bool shouldLoadNewResource(Resource::Type) const { return false; }
136
127 // Called when a resource load is first requested, which may not be when the 137 // Called when a resource load is first requested, which may not be when the
128 // load actually begins. 138 // load actually begins.
129 enum class V8ActivityLoggingPolicy { SuppressLogging, Log }; 139 virtual void recordLoadingActivity(unsigned long identifier,
130 virtual void willStartLoadingResource(unsigned long identifier, 140 const ResourceRequest&,
131 ResourceRequest&, 141 Resource::Type,
132 Resource::Type, 142 const AtomicString& fetchInitiatorName);
133 const AtomicString& fetchInitiatorName, 143
134 V8ActivityLoggingPolicy);
135 virtual void didLoadResource(Resource*); 144 virtual void didLoadResource(Resource*);
136 145
137 virtual void addResourceTiming(const ResourceTimingInfo&); 146 virtual void addResourceTiming(const ResourceTimingInfo&);
138 virtual bool allowImage(bool, const KURL&) const { return false; } 147 virtual bool allowImage(bool, const KURL&) const { return false; }
139 virtual ResourceRequestBlockedReason canRequest( 148 virtual ResourceRequestBlockedReason canRequest(
140 Resource::Type, 149 Resource::Type,
141 const ResourceRequest&, 150 const ResourceRequest&,
142 const KURL&, 151 const KURL&,
143 const ResourceLoaderOptions&, 152 const ResourceLoaderOptions&,
144 SecurityViolationReportingPolicy, 153 SecurityViolationReportingPolicy,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 197
189 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; } 198 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; }
190 199
191 protected: 200 protected:
192 FetchContext() {} 201 FetchContext() {}
193 }; 202 };
194 203
195 } // namespace blink 204 } // namespace blink
196 205
197 #endif 206 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698