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 // The basic usage of the Filter interface is described in the comment at | 5 // The basic usage of the Filter interface is described in the comment at |
6 // the beginning of filter.h. If Filter::Factory is passed a vector of | 6 // the beginning of filter.h. If Filter::Factory is passed a vector of |
7 // size greater than 1, that interface is implemented by a series of filters | 7 // size greater than 1, that interface is implemented by a series of filters |
8 // connected in a chain. In such a case the first filter | 8 // connected in a chain. In such a case the first filter |
9 // in the chain proxies calls to ReadData() so that its return values | 9 // in the chain proxies calls to ReadData() so that its return values |
10 // apply to the entire chain. | 10 // apply to the entire chain. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // However, if it's not a supported mime type, then we will attempt to | 222 // However, if it's not a supported mime type, then we will attempt to |
223 // download it, and in that case, don't decompress .gz/.tgz files. | 223 // download it, and in that case, don't decompress .gz/.tgz files. |
224 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || | 224 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || |
225 LowerCaseEqualsASCII(extension, ".tgz")) && | 225 LowerCaseEqualsASCII(extension, ".tgz")) && |
226 !IsSupportedMimeType(mime_type)) | 226 !IsSupportedMimeType(mime_type)) |
227 encoding_types->clear(); | 227 encoding_types->clear(); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 // If the request was for SDCH content, then we might need additional fixups. | 231 // If the request was for SDCH content, then we might need additional fixups. |
232 if (!filter_context.SdchResponseExpected()) { | 232 if (!filter_context.SdchDictionariesAdvertised()) { |
233 // It was not an SDCH request, so we'll just record stats. | 233 // It was not an SDCH request, so we'll just record stats. |
234 if (1 < encoding_types->size()) { | 234 if (1 < encoding_types->size()) { |
235 // Multiple filters were intended to only be used for SDCH (thus far!) | 235 // Multiple filters were intended to only be used for SDCH (thus far!) |
236 SdchManager::SdchErrorRecovery( | 236 SdchManager::SdchErrorRecovery( |
237 SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST); | 237 SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST); |
238 } | 238 } |
239 if ((1 == encoding_types->size()) && | 239 if ((1 == encoding_types->size()) && |
240 (FILTER_TYPE_SDCH == encoding_types->front())) { | 240 (FILTER_TYPE_SDCH == encoding_types->front())) { |
241 SdchManager::SdchErrorRecovery( | 241 SdchManager::SdchErrorRecovery( |
242 SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); | 242 SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 void Filter::PushDataIntoNextFilter() { | 424 void Filter::PushDataIntoNextFilter() { |
425 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 425 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
426 int next_size = next_filter_->stream_buffer_size(); | 426 int next_size = next_filter_->stream_buffer_size(); |
427 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 427 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
428 if (FILTER_ERROR != last_status_) | 428 if (FILTER_ERROR != last_status_) |
429 next_filter_->FlushStreamBuffer(next_size); | 429 next_filter_->FlushStreamBuffer(next_size); |
430 } | 430 } |
431 | 431 |
432 } // namespace net | 432 } // namespace net |
OLD | NEW |