| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 public: | 211 public: |
| 212 explicit Context(WebURLLoaderImpl* loader); | 212 explicit Context(WebURLLoaderImpl* loader); |
| 213 | 213 |
| 214 WebURLLoaderClient* client() const { return client_; } | 214 WebURLLoaderClient* client() const { return client_; } |
| 215 void set_client(WebURLLoaderClient* client) { client_ = client; } | 215 void set_client(WebURLLoaderClient* client) { client_ = client; } |
| 216 | 216 |
| 217 void Cancel(); | 217 void Cancel(); |
| 218 void SetDefersLoading(bool value); | 218 void SetDefersLoading(bool value); |
| 219 void DidChangePriority(WebURLRequest::Priority new_priority, | 219 void DidChangePriority(WebURLRequest::Priority new_priority, |
| 220 int intra_priority_value); | 220 int intra_priority_value); |
| 221 bool AttachThreadedDataReceiver( | |
| 222 blink::WebThreadedDataReceiver* threaded_data_receiver); | |
| 223 void Start(const WebURLRequest& request, | 221 void Start(const WebURLRequest& request, |
| 224 SyncLoadResponse* sync_load_response); | 222 SyncLoadResponse* sync_load_response); |
| 225 | 223 |
| 226 // RequestPeer methods: | 224 // RequestPeer methods: |
| 227 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 225 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
| 228 virtual bool OnReceivedRedirect(const GURL& new_url, | 226 virtual bool OnReceivedRedirect(const GURL& new_url, |
| 229 const GURL& new_first_party_for_cookies, | 227 const GURL& new_first_party_for_cookies, |
| 230 const ResourceResponseInfo& info) OVERRIDE; | 228 const ResourceResponseInfo& info) OVERRIDE; |
| 231 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE; | 229 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE; |
| 232 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; | 230 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 bridge_->SetDefersLoading(value); | 288 bridge_->SetDefersLoading(value); |
| 291 } | 289 } |
| 292 | 290 |
| 293 void WebURLLoaderImpl::Context::DidChangePriority( | 291 void WebURLLoaderImpl::Context::DidChangePriority( |
| 294 WebURLRequest::Priority new_priority, int intra_priority_value) { | 292 WebURLRequest::Priority new_priority, int intra_priority_value) { |
| 295 if (bridge_) | 293 if (bridge_) |
| 296 bridge_->DidChangePriority( | 294 bridge_->DidChangePriority( |
| 297 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); | 295 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); |
| 298 } | 296 } |
| 299 | 297 |
| 300 bool WebURLLoaderImpl::Context::AttachThreadedDataReceiver( | |
| 301 blink::WebThreadedDataReceiver* threaded_data_receiver) { | |
| 302 if (bridge_) | |
| 303 return bridge_->AttachThreadedDataReceiver(threaded_data_receiver); | |
| 304 | |
| 305 return false; | |
| 306 } | |
| 307 | |
| 308 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, | 298 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
| 309 SyncLoadResponse* sync_load_response) { | 299 SyncLoadResponse* sync_load_response) { |
| 310 DCHECK(!bridge_.get()); | 300 DCHECK(!bridge_.get()); |
| 311 | 301 |
| 312 request_ = request; // Save the request. | 302 request_ = request; // Save the request. |
| 313 | 303 |
| 314 GURL url = request.url(); | 304 GURL url = request.url(); |
| 315 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 305 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| 316 if (sync_load_response) { | 306 if (sync_load_response) { |
| 317 // This is a sync load. Do the work now. | 307 // This is a sync load. Do the work now. |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 | 859 |
| 870 void WebURLLoaderImpl::setDefersLoading(bool value) { | 860 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 871 context_->SetDefersLoading(value); | 861 context_->SetDefersLoading(value); |
| 872 } | 862 } |
| 873 | 863 |
| 874 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, | 864 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, |
| 875 int intra_priority_value) { | 865 int intra_priority_value) { |
| 876 context_->DidChangePriority(new_priority, intra_priority_value); | 866 context_->DidChangePriority(new_priority, intra_priority_value); |
| 877 } | 867 } |
| 878 | 868 |
| 879 bool WebURLLoaderImpl::attachThreadedDataReceiver( | |
| 880 blink::WebThreadedDataReceiver* threaded_data_receiver) { | |
| 881 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | |
| 882 } | |
| 883 | |
| 884 } // namespace content | 869 } // namespace content |
| OLD | NEW |