OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // ResourceLoaderBridge::Peer methods: | 213 // ResourceLoaderBridge::Peer methods: |
214 virtual void OnUploadProgress(uint64 position, uint64 size); | 214 virtual void OnUploadProgress(uint64 position, uint64 size); |
215 virtual bool OnReceivedRedirect( | 215 virtual bool OnReceivedRedirect( |
216 const GURL& new_url, const ResourceLoaderBridge::ResponseInfo& info); | 216 const GURL& new_url, const ResourceLoaderBridge::ResponseInfo& info); |
217 virtual void OnReceivedResponse( | 217 virtual void OnReceivedResponse( |
218 const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); | 218 const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); |
219 virtual void OnReceivedData(const char* data, int len); | 219 virtual void OnReceivedData(const char* data, int len); |
220 virtual void OnCompletedRequest( | 220 virtual void OnCompletedRequest( |
221 const URLRequestStatus& status, const std::string& security_info); | 221 const URLRequestStatus& status, const std::string& security_info); |
222 virtual std::string GetURLForDebugging(); | 222 virtual GURL GetURLForDebugging() const; |
223 | 223 |
224 private: | 224 private: |
225 friend class base::RefCounted<Context>; | 225 friend class base::RefCounted<Context>; |
226 ~Context() {} | 226 ~Context() {} |
227 | 227 |
228 void HandleDataURL(); | 228 void HandleDataURL(); |
229 | 229 |
230 WebURLLoaderImpl* loader_; | 230 WebURLLoaderImpl* loader_; |
231 WebURLRequest request_; | 231 WebURLRequest request_; |
232 WebURLLoaderClient* client_; | 232 WebURLLoaderClient* client_; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 client_->didFinishLoading(loader_); | 515 client_->didFinishLoading(loader_); |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 // We are done with the bridge now, and so we need to release the reference | 519 // We are done with the bridge now, and so we need to release the reference |
520 // to ourselves that we took on behalf of the bridge. This may cause our | 520 // to ourselves that we took on behalf of the bridge. This may cause our |
521 // destruction. | 521 // destruction. |
522 Release(); | 522 Release(); |
523 } | 523 } |
524 | 524 |
525 std::string WebURLLoaderImpl::Context::GetURLForDebugging() { | 525 GURL WebURLLoaderImpl::Context::GetURLForDebugging() const { |
526 return request_.url().spec(); | 526 return request_.url(); |
527 } | 527 } |
528 | 528 |
529 void WebURLLoaderImpl::Context::HandleDataURL() { | 529 void WebURLLoaderImpl::Context::HandleDataURL() { |
530 ResourceLoaderBridge::ResponseInfo info; | 530 ResourceLoaderBridge::ResponseInfo info; |
531 URLRequestStatus status; | 531 URLRequestStatus status; |
532 std::string data; | 532 std::string data; |
533 | 533 |
534 if (GetInfoFromDataURL(request_.url(), &info, &data, &status)) { | 534 if (GetInfoFromDataURL(request_.url(), &info, &data, &status)) { |
535 OnReceivedResponse(info, false); | 535 OnReceivedResponse(info, false); |
536 if (!data.empty()) | 536 if (!data.empty()) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 void WebURLLoaderImpl::cancel() { | 588 void WebURLLoaderImpl::cancel() { |
589 context_->Cancel(); | 589 context_->Cancel(); |
590 } | 590 } |
591 | 591 |
592 void WebURLLoaderImpl::setDefersLoading(bool value) { | 592 void WebURLLoaderImpl::setDefersLoading(bool value) { |
593 context_->SetDefersLoading(value); | 593 context_->SetDefersLoading(value); |
594 } | 594 } |
595 | 595 |
596 } // namespace webkit_glue | 596 } // namespace webkit_glue |
OLD | NEW |