OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "content/child/web_url_loader_impl.h" | 7 #include "content/child/web_url_loader_impl.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 public: | 225 public: |
226 explicit Context(WebURLLoaderImpl* loader); | 226 explicit Context(WebURLLoaderImpl* loader); |
227 | 227 |
228 WebURLLoaderClient* client() const { return client_; } | 228 WebURLLoaderClient* client() const { return client_; } |
229 void set_client(WebURLLoaderClient* client) { client_ = client; } | 229 void set_client(WebURLLoaderClient* client) { client_ = client; } |
230 | 230 |
231 void Cancel(); | 231 void Cancel(); |
232 void SetDefersLoading(bool value); | 232 void SetDefersLoading(bool value); |
233 void DidChangePriority(WebURLRequest::Priority new_priority, | 233 void DidChangePriority(WebURLRequest::Priority new_priority, |
234 int intra_priority_value); | 234 int intra_priority_value); |
| 235 bool AttachThreadedDataReceiver( |
| 236 blink::WebThreadedDataReceiver* threaded_data_receiver); |
235 void Start(const WebURLRequest& request, | 237 void Start(const WebURLRequest& request, |
236 SyncLoadResponse* sync_load_response); | 238 SyncLoadResponse* sync_load_response); |
237 | 239 |
238 // RequestPeer methods: | 240 // RequestPeer methods: |
239 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 241 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
240 virtual bool OnReceivedRedirect(const GURL& new_url, | 242 virtual bool OnReceivedRedirect(const GURL& new_url, |
241 const GURL& new_first_party_for_cookies, | 243 const GURL& new_first_party_for_cookies, |
242 const ResourceResponseInfo& info) OVERRIDE; | 244 const ResourceResponseInfo& info) OVERRIDE; |
243 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE; | 245 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE; |
244 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; | 246 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 bridge_->SetDefersLoading(value); | 304 bridge_->SetDefersLoading(value); |
303 } | 305 } |
304 | 306 |
305 void WebURLLoaderImpl::Context::DidChangePriority( | 307 void WebURLLoaderImpl::Context::DidChangePriority( |
306 WebURLRequest::Priority new_priority, int intra_priority_value) { | 308 WebURLRequest::Priority new_priority, int intra_priority_value) { |
307 if (bridge_) | 309 if (bridge_) |
308 bridge_->DidChangePriority( | 310 bridge_->DidChangePriority( |
309 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); | 311 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); |
310 } | 312 } |
311 | 313 |
| 314 bool WebURLLoaderImpl::Context::AttachThreadedDataReceiver( |
| 315 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
| 316 if (bridge_) |
| 317 return bridge_->AttachThreadedDataReceiver(threaded_data_receiver); |
| 318 |
| 319 return false; |
| 320 } |
| 321 |
312 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, | 322 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
313 SyncLoadResponse* sync_load_response) { | 323 SyncLoadResponse* sync_load_response) { |
314 DCHECK(!bridge_.get()); | 324 DCHECK(!bridge_.get()); |
315 | 325 |
316 request_ = request; // Save the request. | 326 request_ = request; // Save the request. |
317 | 327 |
318 GURL url = request.url(); | 328 GURL url = request.url(); |
319 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 329 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
320 if (sync_load_response) { | 330 if (sync_load_response) { |
321 // This is a sync load. Do the work now. | 331 // This is a sync load. Do the work now. |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 | 885 |
876 void WebURLLoaderImpl::setDefersLoading(bool value) { | 886 void WebURLLoaderImpl::setDefersLoading(bool value) { |
877 context_->SetDefersLoading(value); | 887 context_->SetDefersLoading(value); |
878 } | 888 } |
879 | 889 |
880 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, | 890 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, |
881 int intra_priority_value) { | 891 int intra_priority_value) { |
882 context_->DidChangePriority(new_priority, intra_priority_value); | 892 context_->DidChangePriority(new_priority, intra_priority_value); |
883 } | 893 } |
884 | 894 |
| 895 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
| 896 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
| 897 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
| 898 } |
| 899 |
885 } // namespace content | 900 } // namespace content |
OLD | NEW |