Chromium Code Reviews| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 public ResourceLoaderBridge::Peer { | 222 public ResourceLoaderBridge::Peer { |
| 223 public: | 223 public: |
| 224 explicit Context(WebURLLoaderImpl* loader); | 224 explicit Context(WebURLLoaderImpl* loader); |
| 225 | 225 |
| 226 WebURLLoaderClient* client() const { return client_; } | 226 WebURLLoaderClient* client() const { return client_; } |
| 227 void set_client(WebURLLoaderClient* client) { client_ = client; } | 227 void set_client(WebURLLoaderClient* client) { client_ = client; } |
| 228 | 228 |
| 229 void Cancel(); | 229 void Cancel(); |
| 230 void SetDefersLoading(bool value); | 230 void SetDefersLoading(bool value); |
| 231 void DidChangePriority(WebURLRequest::Priority new_priority); | 231 void DidChangePriority(WebURLRequest::Priority new_priority); |
| 232 bool AttachThreadedDataReceiver( | |
| 233 blink::WebThreadedDataReceiver* threadedDataReceiver); | |
|
darin (slow to review)
2014/03/31 17:00:01
nit: threaded_data_receiver
| |
| 232 void Start(const WebURLRequest& request, | 234 void Start(const WebURLRequest& request, |
| 233 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 235 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 234 BlinkPlatformImpl* platform); | 236 BlinkPlatformImpl* platform); |
| 235 | 237 |
| 236 // ResourceLoaderBridge::Peer methods: | 238 // ResourceLoaderBridge::Peer methods: |
| 237 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 239 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
| 238 virtual bool OnReceivedRedirect( | 240 virtual bool OnReceivedRedirect( |
| 239 const GURL& new_url, | 241 const GURL& new_url, |
| 240 const ResourceResponseInfo& info, | 242 const ResourceResponseInfo& info, |
| 241 bool* has_new_first_party_for_cookies, | 243 bool* has_new_first_party_for_cookies, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 bridge_->SetDefersLoading(value); | 301 bridge_->SetDefersLoading(value); |
| 300 } | 302 } |
| 301 | 303 |
| 302 void WebURLLoaderImpl::Context::DidChangePriority( | 304 void WebURLLoaderImpl::Context::DidChangePriority( |
| 303 WebURLRequest::Priority new_priority) { | 305 WebURLRequest::Priority new_priority) { |
| 304 if (bridge_) | 306 if (bridge_) |
| 305 bridge_->DidChangePriority( | 307 bridge_->DidChangePriority( |
| 306 ConvertWebKitPriorityToNetPriority(new_priority)); | 308 ConvertWebKitPriorityToNetPriority(new_priority)); |
| 307 } | 309 } |
| 308 | 310 |
| 311 bool WebURLLoaderImpl::Context::AttachThreadedDataReceiver( | |
| 312 blink::WebThreadedDataReceiver* threadedDataReceiver) { | |
|
darin (slow to review)
2014/03/31 17:00:01
nit: threaded_data_receiver
| |
| 313 if (bridge_) | |
| 314 return bridge_->AttachThreadedDataReceiver(threadedDataReceiver); | |
|
darin (slow to review)
2014/03/31 17:00:01
ditto
| |
| 315 | |
| 316 return false; | |
| 317 } | |
| 318 | |
| 309 void WebURLLoaderImpl::Context::Start( | 319 void WebURLLoaderImpl::Context::Start( |
| 310 const WebURLRequest& request, | 320 const WebURLRequest& request, |
| 311 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 321 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 312 BlinkPlatformImpl* platform) { | 322 BlinkPlatformImpl* platform) { |
| 313 DCHECK(!bridge_.get()); | 323 DCHECK(!bridge_.get()); |
| 314 | 324 |
| 315 request_ = request; // Save the request. | 325 request_ = request; // Save the request. |
| 316 | 326 |
| 317 GURL url = request.url(); | 327 GURL url = request.url(); |
| 318 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 328 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 865 } | 875 } |
| 866 | 876 |
| 867 void WebURLLoaderImpl::setDefersLoading(bool value) { | 877 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 868 context_->SetDefersLoading(value); | 878 context_->SetDefersLoading(value); |
| 869 } | 879 } |
| 870 | 880 |
| 871 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { | 881 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { |
| 872 context_->DidChangePriority(new_priority); | 882 context_->DidChangePriority(new_priority); |
| 873 } | 883 } |
| 874 | 884 |
| 885 bool WebURLLoaderImpl::attachThreadedDataReceiver( | |
| 886 blink::WebThreadedDataReceiver* threadedDataReceiver) { | |
|
darin (slow to review)
2014/03/31 17:00:01
nit: threaded_data_receiver
| |
| 887 return context_->AttachThreadedDataReceiver(threadedDataReceiver); | |
|
darin (slow to review)
2014/03/31 17:00:01
ditto
| |
| 888 } | |
| 889 | |
| 875 } // namespace content | 890 } // namespace content |
| OLD | NEW |