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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 next_stream_data_ = stream_buffer()->data(); | 177 next_stream_data_ = stream_buffer()->data(); |
178 stream_data_len_ = stream_data_len; | 178 stream_data_len_ = stream_data_len; |
179 last_status_ = FILTER_OK; | 179 last_status_ = FILTER_OK; |
180 return true; | 180 return true; |
181 } | 181 } |
182 | 182 |
183 // static | 183 // static |
184 Filter::FilterType Filter::ConvertEncodingToType( | 184 Filter::FilterType Filter::ConvertEncodingToType( |
185 const std::string& filter_type) { | 185 const std::string& filter_type) { |
186 FilterType type_id; | 186 FilterType type_id; |
187 if (LowerCaseEqualsASCII(filter_type, kDeflate)) { | 187 if (base::LowerCaseEqualsASCII(filter_type, kDeflate)) { |
188 type_id = FILTER_TYPE_DEFLATE; | 188 type_id = FILTER_TYPE_DEFLATE; |
189 } else if (LowerCaseEqualsASCII(filter_type, kGZip) || | 189 } else if (base::LowerCaseEqualsASCII(filter_type, kGZip) || |
190 LowerCaseEqualsASCII(filter_type, kXGZip)) { | 190 base::LowerCaseEqualsASCII(filter_type, kXGZip)) { |
191 type_id = FILTER_TYPE_GZIP; | 191 type_id = FILTER_TYPE_GZIP; |
192 } else if (LowerCaseEqualsASCII(filter_type, kSdch)) { | 192 } else if (base::LowerCaseEqualsASCII(filter_type, kSdch)) { |
193 type_id = FILTER_TYPE_SDCH; | 193 type_id = FILTER_TYPE_SDCH; |
194 } else { | 194 } else { |
195 // Note we also consider "identity" and "uncompressed" UNSUPPORTED as | 195 // Note we also consider "identity" and "uncompressed" UNSUPPORTED as |
196 // filter should be disabled in such cases. | 196 // filter should be disabled in such cases. |
197 type_id = FILTER_TYPE_UNSUPPORTED; | 197 type_id = FILTER_TYPE_UNSUPPORTED; |
198 } | 198 } |
199 return type_id; | 199 return type_id; |
200 } | 200 } |
201 | 201 |
202 // static | 202 // static |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 void Filter::PushDataIntoNextFilter() { | 405 void Filter::PushDataIntoNextFilter() { |
406 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 406 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
407 int next_size = next_filter_->stream_buffer_size(); | 407 int next_size = next_filter_->stream_buffer_size(); |
408 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 408 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
409 if (FILTER_ERROR != last_status_) | 409 if (FILTER_ERROR != last_status_) |
410 next_filter_->FlushStreamBuffer(next_size); | 410 next_filter_->FlushStreamBuffer(next_size); |
411 } | 411 } |
412 | 412 |
413 } // namespace net | 413 } // namespace net |
OLD | NEW |