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