OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 explicit Context(WebURLLoaderImpl* loader); | 256 explicit Context(WebURLLoaderImpl* loader); |
257 | 257 |
258 WebURLLoaderClient* client() const { return client_; } | 258 WebURLLoaderClient* client() const { return client_; } |
259 void set_client(WebURLLoaderClient* client) { client_ = client; } | 259 void set_client(WebURLLoaderClient* client) { client_ = client; } |
260 | 260 |
261 void Cancel(); | 261 void Cancel(); |
262 void SetDefersLoading(bool value); | 262 void SetDefersLoading(bool value); |
263 void Start( | 263 void Start( |
264 const WebURLRequest& request, | 264 const WebURLRequest& request, |
265 ResourceLoaderBridge::SyncLoadResponse* sync_load_response); | 265 ResourceLoaderBridge::SyncLoadResponse* sync_load_response); |
| 266 void UpdateRoutingId(int new_routing_id); |
266 | 267 |
267 // ResourceLoaderBridge::Peer methods: | 268 // ResourceLoaderBridge::Peer methods: |
268 virtual void OnUploadProgress(uint64 position, uint64 size); | 269 virtual void OnUploadProgress(uint64 position, uint64 size); |
269 virtual bool OnReceivedRedirect( | 270 virtual bool OnReceivedRedirect( |
270 const GURL& new_url, | 271 const GURL& new_url, |
271 const ResourceResponseInfo& info, | 272 const ResourceResponseInfo& info, |
272 bool* has_new_first_party_for_cookies, | 273 bool* has_new_first_party_for_cookies, |
273 GURL* new_first_party_for_cookies); | 274 GURL* new_first_party_for_cookies); |
274 virtual void OnReceivedResponse(const ResourceResponseInfo& info); | 275 virtual void OnReceivedResponse(const ResourceResponseInfo& info); |
275 virtual void OnDownloadedData(int len); | 276 virtual void OnDownloadedData(int len); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Do not make any further calls to the client. | 318 // Do not make any further calls to the client. |
318 client_ = NULL; | 319 client_ = NULL; |
319 loader_ = NULL; | 320 loader_ = NULL; |
320 } | 321 } |
321 | 322 |
322 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { | 323 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
323 if (bridge_.get()) | 324 if (bridge_.get()) |
324 bridge_->SetDefersLoading(value); | 325 bridge_->SetDefersLoading(value); |
325 } | 326 } |
326 | 327 |
| 328 void WebURLLoaderImpl::Context::UpdateRoutingId(int new_routing_id) { |
| 329 if (bridge_.get()) |
| 330 bridge_->UpdateRoutingId(new_routing_id); |
| 331 } |
| 332 |
327 void WebURLLoaderImpl::Context::Start( | 333 void WebURLLoaderImpl::Context::Start( |
328 const WebURLRequest& request, | 334 const WebURLRequest& request, |
329 ResourceLoaderBridge::SyncLoadResponse* sync_load_response) { | 335 ResourceLoaderBridge::SyncLoadResponse* sync_load_response) { |
330 DCHECK(!bridge_.get()); | 336 DCHECK(!bridge_.get()); |
331 | 337 |
332 request_ = request; // Save the request. | 338 request_ = request; // Save the request. |
333 | 339 |
334 GURL url = request.url(); | 340 GURL url = request.url(); |
335 if (url.SchemeIs("data") && CanHandleDataURL(url)) { | 341 if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
336 if (sync_load_response) { | 342 if (sync_load_response) { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 } | 728 } |
723 | 729 |
724 void WebURLLoaderImpl::cancel() { | 730 void WebURLLoaderImpl::cancel() { |
725 context_->Cancel(); | 731 context_->Cancel(); |
726 } | 732 } |
727 | 733 |
728 void WebURLLoaderImpl::setDefersLoading(bool value) { | 734 void WebURLLoaderImpl::setDefersLoading(bool value) { |
729 context_->SetDefersLoading(value); | 735 context_->SetDefersLoading(value); |
730 } | 736 } |
731 | 737 |
| 738 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
| 739 context_->UpdateRoutingId(new_routing_id); |
| 740 } |
| 741 |
732 } // namespace webkit_glue | 742 } // namespace webkit_glue |
OLD | NEW |