| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 WebURLLoaderClient* client() const { return client_; } | 278 WebURLLoaderClient* client() const { return client_; } |
| 279 void set_client(WebURLLoaderClient* client) { client_ = client; } | 279 void set_client(WebURLLoaderClient* client) { client_ = client; } |
| 280 | 280 |
| 281 void Cancel(); | 281 void Cancel(); |
| 282 void SetDefersLoading(bool value); | 282 void SetDefersLoading(bool value); |
| 283 void Start( | 283 void Start( |
| 284 const WebURLRequest& request, | 284 const WebURLRequest& request, |
| 285 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 285 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 286 WebKitPlatformSupportImpl* platform); | 286 WebKitPlatformSupportImpl* platform); |
| 287 void UpdateRoutingId(int new_routing_id); | |
| 288 | 287 |
| 289 // ResourceLoaderBridge::Peer methods: | 288 // ResourceLoaderBridge::Peer methods: |
| 290 virtual void OnUploadProgress(uint64 position, uint64 size); | 289 virtual void OnUploadProgress(uint64 position, uint64 size); |
| 291 virtual bool OnReceivedRedirect( | 290 virtual bool OnReceivedRedirect( |
| 292 const GURL& new_url, | 291 const GURL& new_url, |
| 293 const ResourceResponseInfo& info, | 292 const ResourceResponseInfo& info, |
| 294 bool* has_new_first_party_for_cookies, | 293 bool* has_new_first_party_for_cookies, |
| 295 GURL* new_first_party_for_cookies); | 294 GURL* new_first_party_for_cookies); |
| 296 virtual void OnReceivedResponse(const ResourceResponseInfo& info); | 295 virtual void OnReceivedResponse(const ResourceResponseInfo& info); |
| 297 virtual void OnDownloadedData(int len); | 296 virtual void OnDownloadedData(int len); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Do not make any further calls to the client. | 340 // Do not make any further calls to the client. |
| 342 client_ = NULL; | 341 client_ = NULL; |
| 343 loader_ = NULL; | 342 loader_ = NULL; |
| 344 } | 343 } |
| 345 | 344 |
| 346 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { | 345 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
| 347 if (bridge_.get()) | 346 if (bridge_.get()) |
| 348 bridge_->SetDefersLoading(value); | 347 bridge_->SetDefersLoading(value); |
| 349 } | 348 } |
| 350 | 349 |
| 351 void WebURLLoaderImpl::Context::UpdateRoutingId(int new_routing_id) { | |
| 352 if (bridge_.get()) | |
| 353 bridge_->UpdateRoutingId(new_routing_id); | |
| 354 } | |
| 355 | |
| 356 void WebURLLoaderImpl::Context::Start( | 350 void WebURLLoaderImpl::Context::Start( |
| 357 const WebURLRequest& request, | 351 const WebURLRequest& request, |
| 358 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 352 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
| 359 WebKitPlatformSupportImpl* platform) { | 353 WebKitPlatformSupportImpl* platform) { |
| 360 DCHECK(!bridge_.get()); | 354 DCHECK(!bridge_.get()); |
| 361 | 355 |
| 362 request_ = request; // Save the request. | 356 request_ = request; // Save the request. |
| 363 | 357 |
| 364 GURL url = request.url(); | 358 GURL url = request.url(); |
| 365 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 359 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 } | 757 } |
| 764 | 758 |
| 765 void WebURLLoaderImpl::cancel() { | 759 void WebURLLoaderImpl::cancel() { |
| 766 context_->Cancel(); | 760 context_->Cancel(); |
| 767 } | 761 } |
| 768 | 762 |
| 769 void WebURLLoaderImpl::setDefersLoading(bool value) { | 763 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 770 context_->SetDefersLoading(value); | 764 context_->SetDefersLoading(value); |
| 771 } | 765 } |
| 772 | 766 |
| 773 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | |
| 774 context_->UpdateRoutingId(new_routing_id); | |
| 775 } | |
| 776 | |
| 777 } // namespace webkit_glue | 767 } // namespace webkit_glue |
| OLD | NEW |