| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/child/weburlloader_impl.h" | 7 #include "webkit/child/weburlloader_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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 public ResourceLoaderBridge::Peer { | 217 public ResourceLoaderBridge::Peer { |
| 218 public: | 218 public: |
| 219 explicit Context(WebURLLoaderImpl* loader); | 219 explicit Context(WebURLLoaderImpl* loader); |
| 220 | 220 |
| 221 WebURLLoaderClient* client() const { return client_; } | 221 WebURLLoaderClient* client() const { return client_; } |
| 222 void set_client(WebURLLoaderClient* client) { client_ = client; } | 222 void set_client(WebURLLoaderClient* client) { client_ = client; } |
| 223 | 223 |
| 224 void Cancel(); | 224 void Cancel(); |
| 225 void SetDefersLoading(bool value); | 225 void SetDefersLoading(bool value); |
| 226 void DidChangePriority(WebURLRequest::Priority new_priority); | 226 void DidChangePriority(WebURLRequest::Priority new_priority); |
| 227 blink::WebThreadedResourceProvider* CreateThreadedResourceProvider(); |
| 227 void Start( | 228 void Start( |
| 228 const WebURLRequest& request, | 229 const WebURLRequest& request, |
| 229 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 230 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 230 WebKitPlatformSupportImpl* platform); | 231 WebKitPlatformSupportImpl* platform); |
| 231 | 232 |
| 232 // ResourceLoaderBridge::Peer methods: | 233 // ResourceLoaderBridge::Peer methods: |
| 233 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 234 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
| 234 virtual bool OnReceivedRedirect( | 235 virtual bool OnReceivedRedirect( |
| 235 const GURL& new_url, | 236 const GURL& new_url, |
| 236 const ResourceResponseInfo& info, | 237 const ResourceResponseInfo& info, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 bridge_->SetDefersLoading(value); | 294 bridge_->SetDefersLoading(value); |
| 294 } | 295 } |
| 295 | 296 |
| 296 void WebURLLoaderImpl::Context::DidChangePriority( | 297 void WebURLLoaderImpl::Context::DidChangePriority( |
| 297 WebURLRequest::Priority new_priority) { | 298 WebURLRequest::Priority new_priority) { |
| 298 if (bridge_) | 299 if (bridge_) |
| 299 bridge_->DidChangePriority( | 300 bridge_->DidChangePriority( |
| 300 ConvertWebKitPriorityToNetPriority(new_priority)); | 301 ConvertWebKitPriorityToNetPriority(new_priority)); |
| 301 } | 302 } |
| 302 | 303 |
| 304 blink::WebThreadedResourceProvider* |
| 305 WebURLLoaderImpl::Context::CreateThreadedResourceProvider() { |
| 306 if (bridge_) |
| 307 return bridge_->CreateThreadedResourceProvider(); |
| 308 |
| 309 return NULL; |
| 310 } |
| 311 |
| 303 void WebURLLoaderImpl::Context::Start( | 312 void WebURLLoaderImpl::Context::Start( |
| 304 const WebURLRequest& request, | 313 const WebURLRequest& request, |
| 305 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 314 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 306 WebKitPlatformSupportImpl* platform) { | 315 WebKitPlatformSupportImpl* platform) { |
| 307 DCHECK(!bridge_.get()); | 316 DCHECK(!bridge_.get()); |
| 308 | 317 |
| 309 request_ = request; // Save the request. | 318 request_ = request; // Save the request. |
| 310 | 319 |
| 311 GURL url = request.url(); | 320 GURL url = request.url(); |
| 312 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 321 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 } | 858 } |
| 850 | 859 |
| 851 void WebURLLoaderImpl::setDefersLoading(bool value) { | 860 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 852 context_->SetDefersLoading(value); | 861 context_->SetDefersLoading(value); |
| 853 } | 862 } |
| 854 | 863 |
| 855 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { | 864 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { |
| 856 context_->DidChangePriority(new_priority); | 865 context_->DidChangePriority(new_priority); |
| 857 } | 866 } |
| 858 | 867 |
| 868 blink::WebThreadedResourceProvider* |
| 869 WebURLLoaderImpl::createThreadedResourceProvider() { |
| 870 return context_->CreateThreadedResourceProvider(); |
| 871 } |
| 872 |
| 859 } // namespace webkit_glue | 873 } // namespace webkit_glue |
| OLD | NEW |