Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 6674042: Make URLRequestHttpJob the only URLRequestJob concerned with FilterContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to comments from willchan Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 #include "net/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/file_version_info.h" 11 #include "base/file_version_info.h"
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 int URLRequestHttpJob::GetResponseCode() const { 725 int URLRequestHttpJob::GetResponseCode() const {
726 DCHECK(transaction_.get()); 726 DCHECK(transaction_.get());
727 727
728 if (!response_info_) 728 if (!response_info_)
729 return -1; 729 return -1;
730 730
731 return response_info_->headers->response_code(); 731 return response_info_->headers->response_code();
732 } 732 }
733 733
734 bool URLRequestHttpJob::GetContentEncodings( 734 Filter* URLRequestHttpJob::SetupFilter() const {
735 std::vector<Filter::FilterType>* encoding_types) {
736 DCHECK(transaction_.get()); 735 DCHECK(transaction_.get());
737 if (!response_info_) 736 if (!response_info_)
738 return false; 737 return NULL;
739 DCHECK(encoding_types->empty());
740 738
739 std::vector<Filter::FilterType> encoding_types;
741 std::string encoding_type; 740 std::string encoding_type;
742 void* iter = NULL; 741 void* iter = NULL;
743 while (response_info_->headers->EnumerateHeader(&iter, "Content-Encoding", 742 while (response_info_->headers->EnumerateHeader(&iter, "Content-Encoding",
744 &encoding_type)) { 743 &encoding_type)) {
745 encoding_types->push_back(Filter::ConvertEncodingToType(encoding_type)); 744 encoding_types.push_back(Filter::ConvertEncodingToType(encoding_type));
746 } 745 }
747 746
748 // Even if encoding types are empty, there is a chance that we need to add 747 // Even if encoding types are empty, there is a chance that we need to add
749 // some decoding, as some proxies strip encoding completely. In such cases, 748 // some decoding, as some proxies strip encoding completely. In such cases,
750 // we may need to add (for example) SDCH filtering (when the context suggests 749 // we may need to add (for example) SDCH filtering (when the context suggests
751 // it is appropriate). 750 // it is appropriate).
752 Filter::FixupEncodingTypes(*this, encoding_types); 751 Filter::FixupEncodingTypes(*this, &encoding_types);
753 752
754 return !encoding_types->empty(); 753 return !encoding_types.empty()
754 ? Filter::Factory(encoding_types, *this) : NULL;
755 } 755 }
756 756
757 bool URLRequestHttpJob::IsCachedContent() const { 757 bool URLRequestHttpJob::IsCachedContent() const {
758 return is_cached_content_; 758 return is_cached_content_;
759 } 759 }
760 760
761 bool URLRequestHttpJob::IsSdchResponse() const { 761 bool URLRequestHttpJob::IsSdchResponse() const {
762 return sdch_dictionary_advertised_; 762 return sdch_dictionary_advertised_;
763 } 763 }
764 764
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 void URLRequestHttpJob::ResetTimer() { 987 void URLRequestHttpJob::ResetTimer() {
988 if (!request_creation_time_.is_null()) { 988 if (!request_creation_time_.is_null()) {
989 NOTREACHED() 989 NOTREACHED()
990 << "The timer was reset before it was recorded."; 990 << "The timer was reset before it was recorded.";
991 return; 991 return;
992 } 992 }
993 request_creation_time_ = base::Time::Now(); 993 request_creation_time_ = base::Time::Now();
994 } 994 }
995 995
996 } // namespace net 996 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698