OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/filter/filter.h" | 5 #include "net/filter/filter.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "net/base/filename_util_unsafe.h" | 9 #include "net/base/filename_util_unsafe.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // However, if it's not a supported mime type, then we will attempt to | 199 // However, if it's not a supported mime type, then we will attempt to |
200 // download it, and in that case, don't decompress .gz/.tgz files. | 200 // download it, and in that case, don't decompress .gz/.tgz files. |
201 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || | 201 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || |
202 LowerCaseEqualsASCII(extension, ".tgz")) && | 202 LowerCaseEqualsASCII(extension, ".tgz")) && |
203 !IsSupportedMimeType(mime_type)) | 203 !IsSupportedMimeType(mime_type)) |
204 encoding_types->clear(); | 204 encoding_types->clear(); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 // If the request was for SDCH content, then we might need additional fixups. | 208 // If the request was for SDCH content, then we might need additional fixups. |
209 if (!filter_context.IsSdchResponse()) { | 209 if (!filter_context.SdchResponseExpected()) { |
210 // It was not an SDCH request, so we'll just record stats. | 210 // It was not an SDCH request, so we'll just record stats. |
211 if (1 < encoding_types->size()) { | 211 if (1 < encoding_types->size()) { |
212 // Multiple filters were intended to only be used for SDCH (thus far!) | 212 // Multiple filters were intended to only be used for SDCH (thus far!) |
213 SdchManager::SdchErrorRecovery( | 213 SdchManager::SdchErrorRecovery( |
214 SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST); | 214 SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST); |
215 } | 215 } |
216 if ((1 == encoding_types->size()) && | 216 if ((1 == encoding_types->size()) && |
217 (FILTER_TYPE_SDCH == encoding_types->front())) { | 217 (FILTER_TYPE_SDCH == encoding_types->front())) { |
218 SdchManager::SdchErrorRecovery( | 218 SdchManager::SdchErrorRecovery( |
219 SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); | 219 SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 void Filter::PushDataIntoNextFilter() { | 401 void Filter::PushDataIntoNextFilter() { |
402 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 402 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
403 int next_size = next_filter_->stream_buffer_size(); | 403 int next_size = next_filter_->stream_buffer_size(); |
404 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 404 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
405 if (FILTER_ERROR != last_status_) | 405 if (FILTER_ERROR != last_status_) |
406 next_filter_->FlushStreamBuffer(next_size); | 406 next_filter_->FlushStreamBuffer(next_size); |
407 } | 407 } |
408 | 408 |
409 } // namespace net | 409 } // namespace net |
OLD | NEW |