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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // However, if it's not a supported mime type, then we will attempt to | 231 // However, if it's not a supported mime type, then we will attempt to |
232 // download it, and in that case, don't decompress .gz/.tgz files. | 232 // download it, and in that case, don't decompress .gz/.tgz files. |
233 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || | 233 if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) || |
234 LowerCaseEqualsASCII(extension, ".tgz")) && | 234 LowerCaseEqualsASCII(extension, ".tgz")) && |
235 !IsSupportedMimeType(mime_type)) | 235 !IsSupportedMimeType(mime_type)) |
236 encoding_types->clear(); | 236 encoding_types->clear(); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 // If the request was for SDCH content, then we might need additional fixups. | 240 // If the request was for SDCH content, then we might need additional fixups. |
241 if (!filter_context.SdchResponseExpected()) { | 241 if (!filter_context.SdchDictionariesAdvertised()) { |
242 // It was not an SDCH request, so we'll just record stats. | 242 // It was not an SDCH request, so we'll just record stats. |
243 if (1 < encoding_types->size()) { | 243 if (1 < encoding_types->size()) { |
244 // Multiple filters were intended to only be used for SDCH (thus far!) | 244 // Multiple filters were intended to only be used for SDCH (thus far!) |
245 LogSdchProblem(filter_context, SDCH_MULTIENCODING_FOR_NON_SDCH_REQUEST); | 245 LogSdchProblem(filter_context, SDCH_MULTIENCODING_FOR_NON_SDCH_REQUEST); |
246 } | 246 } |
247 if ((1 == encoding_types->size()) && | 247 if ((1 == encoding_types->size()) && |
248 (FILTER_TYPE_SDCH == encoding_types->front())) { | 248 (FILTER_TYPE_SDCH == encoding_types->front())) { |
249 LogSdchProblem(filter_context, | 249 LogSdchProblem(filter_context, |
250 SDCH_SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); | 250 SDCH_SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); |
251 } | 251 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 void Filter::PushDataIntoNextFilter() { | 425 void Filter::PushDataIntoNextFilter() { |
426 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 426 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
427 int next_size = next_filter_->stream_buffer_size(); | 427 int next_size = next_filter_->stream_buffer_size(); |
428 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 428 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
429 if (FILTER_ERROR != last_status_) | 429 if (FILTER_ERROR != last_status_) |
430 next_filter_->FlushStreamBuffer(next_size); | 430 next_filter_->FlushStreamBuffer(next_size); |
431 } | 431 } |
432 | 432 |
433 } // namespace net | 433 } // namespace net |
OLD | NEW |