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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, | 224 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
225 public RequestPeer { | 225 public RequestPeer { |
226 public: | 226 public: |
227 explicit Context(WebURLLoaderImpl* loader); | 227 explicit Context(WebURLLoaderImpl* loader); |
228 | 228 |
229 WebURLLoaderClient* client() const { return client_; } | 229 WebURLLoaderClient* client() const { return client_; } |
230 void set_client(WebURLLoaderClient* client) { client_ = client; } | 230 void set_client(WebURLLoaderClient* client) { client_ = client; } |
231 | 231 |
232 void Cancel(); | 232 void Cancel(); |
233 void SetDefersLoading(bool value); | 233 void SetDefersLoading(bool value); |
234 void DidChangePriority(WebURLRequest::Priority new_priority); | 234 void DidChangePriority(WebURLRequest::Priority new_priority, |
| 235 int intra_priority_value); |
235 void Start(const WebURLRequest& request, | 236 void Start(const WebURLRequest& request, |
236 SyncLoadResponse* sync_load_response); | 237 SyncLoadResponse* sync_load_response); |
237 | 238 |
238 // RequestPeer methods: | 239 // RequestPeer methods: |
239 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 240 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
240 virtual bool OnReceivedRedirect( | 241 virtual bool OnReceivedRedirect( |
241 const GURL& new_url, | 242 const GURL& new_url, |
242 const ResourceResponseInfo& info, | 243 const ResourceResponseInfo& info, |
243 bool* has_new_first_party_for_cookies, | 244 bool* has_new_first_party_for_cookies, |
244 GURL* new_first_party_for_cookies) OVERRIDE; | 245 GURL* new_first_party_for_cookies) OVERRIDE; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 client_ = NULL; | 296 client_ = NULL; |
296 loader_ = NULL; | 297 loader_ = NULL; |
297 } | 298 } |
298 | 299 |
299 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { | 300 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
300 if (bridge_) | 301 if (bridge_) |
301 bridge_->SetDefersLoading(value); | 302 bridge_->SetDefersLoading(value); |
302 } | 303 } |
303 | 304 |
304 void WebURLLoaderImpl::Context::DidChangePriority( | 305 void WebURLLoaderImpl::Context::DidChangePriority( |
305 WebURLRequest::Priority new_priority) { | 306 WebURLRequest::Priority new_priority, int intra_priority_value) { |
306 if (bridge_) | 307 if (bridge_) |
307 bridge_->DidChangePriority( | 308 bridge_->DidChangePriority( |
308 ConvertWebKitPriorityToNetPriority(new_priority)); | 309 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); |
309 } | 310 } |
310 | 311 |
311 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, | 312 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
312 SyncLoadResponse* sync_load_response) { | 313 SyncLoadResponse* sync_load_response) { |
313 DCHECK(!bridge_.get()); | 314 DCHECK(!bridge_.get()); |
314 | 315 |
315 request_ = request; // Save the request. | 316 request_ = request; // Save the request. |
316 | 317 |
317 GURL url = request.url(); | 318 GURL url = request.url(); |
318 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 319 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 861 } |
861 | 862 |
862 void WebURLLoaderImpl::cancel() { | 863 void WebURLLoaderImpl::cancel() { |
863 context_->Cancel(); | 864 context_->Cancel(); |
864 } | 865 } |
865 | 866 |
866 void WebURLLoaderImpl::setDefersLoading(bool value) { | 867 void WebURLLoaderImpl::setDefersLoading(bool value) { |
867 context_->SetDefersLoading(value); | 868 context_->SetDefersLoading(value); |
868 } | 869 } |
869 | 870 |
870 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { | 871 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, |
871 context_->DidChangePriority(new_priority); | 872 int intra_priority_value) { |
| 873 context_->DidChangePriority(new_priority, intra_priority_value); |
872 } | 874 } |
873 | 875 |
874 } // namespace content | 876 } // namespace content |
OLD | NEW |