| 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/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, | 278 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
| 279 public ResourceLoaderBridge::Peer { | 279 public ResourceLoaderBridge::Peer { |
| 280 public: | 280 public: |
| 281 explicit Context(WebURLLoaderImpl* loader); | 281 explicit Context(WebURLLoaderImpl* loader); |
| 282 | 282 |
| 283 WebURLLoaderClient* client() const { return client_; } | 283 WebURLLoaderClient* client() const { return client_; } |
| 284 void set_client(WebURLLoaderClient* client) { client_ = client; } | 284 void set_client(WebURLLoaderClient* client) { client_ = client; } |
| 285 | 285 |
| 286 void Cancel(); | 286 void Cancel(); |
| 287 void SetDefersLoading(bool value); | 287 void SetDefersLoading(bool value); |
| 288 void DidChangePriority(WebURLRequest::Priority new_priority); |
| 288 void Start( | 289 void Start( |
| 289 const WebURLRequest& request, | 290 const WebURLRequest& request, |
| 290 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 291 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 291 WebKitPlatformSupportImpl* platform); | 292 WebKitPlatformSupportImpl* platform); |
| 292 | 293 |
| 293 // ResourceLoaderBridge::Peer methods: | 294 // ResourceLoaderBridge::Peer methods: |
| 294 virtual void OnUploadProgress(uint64 position, uint64 size); | 295 virtual void OnUploadProgress(uint64 position, uint64 size); |
| 295 virtual bool OnReceivedRedirect( | 296 virtual bool OnReceivedRedirect( |
| 296 const GURL& new_url, | 297 const GURL& new_url, |
| 297 const ResourceResponseInfo& info, | 298 const ResourceResponseInfo& info, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Do not make any further calls to the client. | 347 // Do not make any further calls to the client. |
| 347 client_ = NULL; | 348 client_ = NULL; |
| 348 loader_ = NULL; | 349 loader_ = NULL; |
| 349 } | 350 } |
| 350 | 351 |
| 351 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { | 352 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
| 352 if (bridge_.get()) | 353 if (bridge_.get()) |
| 353 bridge_->SetDefersLoading(value); | 354 bridge_->SetDefersLoading(value); |
| 354 } | 355 } |
| 355 | 356 |
| 357 void WebURLLoaderImpl::Context::DidChangePriority( |
| 358 WebURLRequest::Priority new_priority) { |
| 359 if (bridge_.get()) |
| 360 bridge_->DidChangePriority(new_priority); |
| 361 } |
| 362 |
| 356 void WebURLLoaderImpl::Context::Start( | 363 void WebURLLoaderImpl::Context::Start( |
| 357 const WebURLRequest& request, | 364 const WebURLRequest& request, |
| 358 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 365 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 359 WebKitPlatformSupportImpl* platform) { | 366 WebKitPlatformSupportImpl* platform) { |
| 360 DCHECK(!bridge_.get()); | 367 DCHECK(!bridge_.get()); |
| 361 | 368 |
| 362 request_ = request; // Save the request. | 369 request_ = request; // Save the request. |
| 363 | 370 |
| 364 GURL url = request.url(); | 371 GURL url = request.url(); |
| 365 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 372 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 783 } |
| 777 | 784 |
| 778 void WebURLLoaderImpl::cancel() { | 785 void WebURLLoaderImpl::cancel() { |
| 779 context_->Cancel(); | 786 context_->Cancel(); |
| 780 } | 787 } |
| 781 | 788 |
| 782 void WebURLLoaderImpl::setDefersLoading(bool value) { | 789 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 783 context_->SetDefersLoading(value); | 790 context_->SetDefersLoading(value); |
| 784 } | 791 } |
| 785 | 792 |
| 793 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { |
| 794 context_->DidChangePriority(new_priority); |
| 795 } |
| 796 |
| 786 } // namespace webkit_glue | 797 } // namespace webkit_glue |
| OLD | NEW |