diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:58:06 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:58:06 +0000 |
commit | 2e4633c5b2a040357659646b951b632bff3055f5 (patch) | |
tree | f4a4ab7e636963a940118157cbec5dd4cc7b4ad4 /chrome/common/net/url_request_intercept_job.cc | |
parent | dba526fa150d26deae1a10f54bc3b72ed36e5520 (diff) | |
download | chromium_src-2e4633c5b2a040357659646b951b632bff3055f5.zip chromium_src-2e4633c5b2a040357659646b951b632bff3055f5.tar.gz chromium_src-2e4633c5b2a040357659646b951b632bff3055f5.tar.bz2 |
A prototype of resource loading through automation
In a test scenario where we need to load resources over
automation, we intercept the URL reqeusts and serve
them using automation IPCs.
This resource loading can be enabled per tab created
by automation.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/145024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/net/url_request_intercept_job.cc')
-rw-r--r-- | chrome/common/net/url_request_intercept_job.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc index bb5dd8c..af1c8c7 100644 --- a/chrome/common/net/url_request_intercept_job.cc +++ b/chrome/common/net/url_request_intercept_job.cc @@ -101,10 +101,25 @@ bool URLRequestInterceptJob::GetCharset(std::string* charset) { return request_->response_headers()->GetCharset(charset); } -bool URLRequestInterceptJob::GetContentEncoding(std::string* encoding_type) { - // TODO(darin): what if there are multiple content encodings? - return request_->response_headers()->EnumerateHeader(NULL, "Content-Encoding", - encoding_type); +bool URLRequestInterceptJob::GetContentEncodings( + std::vector<Filter::FilterType>* encoding_types) { + DCHECK(encoding_types->empty()); + if (!request_->response_headers()) + return false; + + std::string encoding_type; + void* iter = NULL; + while (request_->response_headers()->EnumerateHeader( + &iter, "Content-Encoding", &encoding_type)) { + encoding_types->push_back(Filter::ConvertEncodingToType(encoding_type)); + } + + // Even if encoding types are empty, there is a chance that we need to add + // some decoding, as some proxies strip encoding completely. In such cases, + // we may need to add (for example) SDCH filtering (when the context suggests + // it is appropriate). + Filter::FixupEncodingTypes(*this, encoding_types); + return !encoding_types->empty(); } void URLRequestInterceptJob::GetResponseInfo(net::HttpResponseInfo* info) { |