diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 17:50:34 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 17:50:34 +0000 |
commit | 9a9f43a3057d229113de3d690d6a96420fcec306 (patch) | |
tree | a67d710bdaf473651804c6cf66aa40cb11085bb8 /net | |
parent | 9bbde62b72f050510345469142d742dd09407383 (diff) | |
download | chromium_src-9a9f43a3057d229113de3d690d6a96420fcec306.zip chromium_src-9a9f43a3057d229113de3d690d6a96420fcec306.tar.gz chromium_src-9a9f43a3057d229113de3d690d6a96420fcec306.tar.bz2 |
Decompress .svgz files from disk.
BUG=9936
TEST=Download a .svgz file to local disk, then attempt to view it. Please make sure it didn't get decompressed during the download.
Review URL: http://codereview.chromium.org/99109
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_file_job.cc | 11 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index 8430fc9..b369216 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -167,6 +167,17 @@ bool URLRequestFileJob::ReadRawData(net::IOBuffer* dest, int dest_size, return false; } +bool URLRequestFileJob::GetContentEncodings( + std::vector<Filter::FilterType>* encoding_types) { + DCHECK(encoding_types->empty()); + + // Bug 9936 - .svgz files needs to be decompressed. + if (LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")) + encoding_types->push_back(Filter::FILTER_TYPE_GZIP); + + return !encoding_types->empty(); +} + bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { DCHECK(request_); return net::GetMimeTypeFromFile(file_path_, mime_type); diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h index 3091d2a..6cb16b3 100644 --- a/net/url_request/url_request_file_job.h +++ b/net/url_request/url_request_file_job.h @@ -25,6 +25,8 @@ class URLRequestFileJob : public URLRequestJob { virtual void Kill(); virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); virtual bool IsRedirectResponse(GURL* location, int* http_status_code); + virtual bool GetContentEncodings( + std::vector<Filter::FilterType>* encoding_type); virtual bool GetMimeType(std::string* mime_type) const; virtual void GetResponseInfo(net::HttpResponseInfo* info); virtual void SetExtraRequestHeaders(const std::string& headers); |