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