OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011, 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 // This class bridges the interface differences between WebCore and WebKit loade
r clients. | 118 // This class bridges the interface differences between WebCore and WebKit loade
r clients. |
119 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient. | 119 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient. |
120 class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoader
Client { | 120 class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoader
Client { |
121 WTF_MAKE_NONCOPYABLE(ClientAdapter); | 121 WTF_MAKE_NONCOPYABLE(ClientAdapter); |
122 public: | 122 public: |
123 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl
ient*, const WebURLLoaderOptions&); | 123 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl
ient*, const WebURLLoaderOptions&); |
124 | 124 |
125 // ThreadableLoaderClient | 125 // ThreadableLoaderClient |
126 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota
lBytesToBeSent*/) override; | 126 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota
lBytesToBeSent*/) override; |
127 void didReceiveResponse(unsigned long, const ResourceResponse&) override; | 127 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W
ebDataConsumerHandle>) override; |
128 void didDownloadData(int /*dataLength*/) override; | 128 void didDownloadData(int /*dataLength*/) override; |
129 void didReceiveData(const char*, unsigned /*dataLength*/) override; | 129 void didReceiveData(const char*, unsigned /*dataLength*/) override; |
130 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; | 130 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; |
131 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o
verride; | 131 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o
verride; |
132 void didFail(const ResourceError&) override; | 132 void didFail(const ResourceError&) override; |
133 void didFailRedirectCheck() override; | 133 void didFailRedirectCheck() override; |
134 // DocumentThreadableLoaderClient | 134 // DocumentThreadableLoaderClient |
135 void willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo
nse& /*redirectResponse*/) override; | 135 void willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo
nse& /*redirectResponse*/) override; |
136 | 136 |
137 // Sets an error to be reported back to the client, asychronously. | 137 // Sets an error to be reported back to the client, asychronously. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen
t, unsigned long long totalBytesToBeSent) | 189 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen
t, unsigned long long totalBytesToBeSent) |
190 { | 190 { |
191 if (!m_client) | 191 if (!m_client) |
192 return; | 192 return; |
193 | 193 |
194 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); | 194 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); |
195 } | 195 } |
196 | 196 |
197 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const
ResourceResponse& response) | 197 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const
ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) |
198 { | 198 { |
| 199 ASSERT_UNUSED(handle, !handle); |
199 if (!m_client) | 200 if (!m_client) |
200 return; | 201 return; |
201 | 202 |
202 // Try to use the original ResourceResponse if possible. | 203 // Try to use the original ResourceResponse if possible. |
203 WebURLResponse validatedResponse = WrappedResourceResponse(response); | 204 WebURLResponse validatedResponse = WrappedResourceResponse(response); |
204 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy ==
WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); | 205 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy ==
WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); |
205 if (!m_options.exposeAllResponseHeaders) | 206 if (!m_options.exposeAllResponseHeaders) |
206 validatedResponse.visitHTTPHeaderFields(&validator); | 207 validatedResponse.visitHTTPHeaderFields(&validator); |
207 | 208 |
208 // If there are blocked headers, copy the response so we can remove them. | 209 // If there are blocked headers, copy the response so we can remove them. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 m_loader->cancel(); | 377 m_loader->cancel(); |
377 } | 378 } |
378 | 379 |
379 void AssociatedURLLoader::setDefersLoading(bool defersLoading) | 380 void AssociatedURLLoader::setDefersLoading(bool defersLoading) |
380 { | 381 { |
381 if (m_loader) | 382 if (m_loader) |
382 m_loader->setDefersLoading(defersLoading); | 383 m_loader->setDefersLoading(defersLoading); |
383 } | 384 } |
384 | 385 |
385 } // namespace blink | 386 } // namespace blink |
OLD | NEW |