OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Filter performs filtering on data streams. Sample usage: | 5 // Filter performs filtering on data streams. Sample usage: |
6 // | 6 // |
7 // IStream* pre_filter_source; | 7 // IStream* pre_filter_source; |
8 // ... | 8 // ... |
9 // Filter* filter = Filter::Factory(filter_type, size); | 9 // Filter* filter = Filter::Factory(filter_type, size); |
10 // int pre_filter_data_len = filter->stream_buffer_size(); | 10 // int pre_filter_data_len = filter->stream_buffer_size(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // to the list. This includes handling known bugs in the Apache server (where | 192 // to the list. This includes handling known bugs in the Apache server (where |
193 // redundant gzip encoding is specified), as well as issues regarding SDCH | 193 // redundant gzip encoding is specified), as well as issues regarding SDCH |
194 // encoding, where various proxies and anti-virus products modify or strip the | 194 // encoding, where various proxies and anti-virus products modify or strip the |
195 // encodings. These fixups require context, which includes whether this | 195 // encodings. These fixups require context, which includes whether this |
196 // response was made to an SDCH request (i.e., an available dictionary was | 196 // response was made to an SDCH request (i.e., an available dictionary was |
197 // advertised in the GET), as well as the mime type of the content. | 197 // advertised in the GET), as well as the mime type of the content. |
198 static void FixupEncodingTypes(const FilterContext& filter_context, | 198 static void FixupEncodingTypes(const FilterContext& filter_context, |
199 std::vector<FilterType>* encoding_types); | 199 std::vector<FilterType>* encoding_types); |
200 | 200 |
201 protected: | 201 protected: |
| 202 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, ContentTypeId); |
| 203 |
202 explicit Filter(const FilterContext& filter_context); | 204 explicit Filter(const FilterContext& filter_context); |
203 | 205 |
204 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, ContentTypeId); | |
205 // Filters the data stored in stream_buffer_ and writes the output into the | 206 // Filters the data stored in stream_buffer_ and writes the output into the |
206 // dest_buffer passed in. | 207 // dest_buffer passed in. |
207 // | 208 // |
208 // Upon entry, *dest_len is the total size (in number of chars) of the | 209 // Upon entry, *dest_len is the total size (in number of chars) of the |
209 // destination buffer. Upon exit, *dest_len is the actual number of chars | 210 // destination buffer. Upon exit, *dest_len is the actual number of chars |
210 // written into the destination buffer. | 211 // written into the destination buffer. |
211 // | 212 // |
212 // This function will fail if there is no pre-filter data in the | 213 // This function will fail if there is no pre-filter data in the |
213 // stream_buffer_. On the other hand, *dest_len can be 0 upon successful | 214 // stream_buffer_. On the other hand, *dest_len can be 0 upon successful |
214 // return. For example, a decoding filter may process some pre-filter data | 215 // return. For example, a decoding filter may process some pre-filter data |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 261 |
261 // Context data from the owner of this filter. Some filters need additional | 262 // Context data from the owner of this filter. Some filters need additional |
262 // context information (mime type, etc.) to properly function, and they access | 263 // context information (mime type, etc.) to properly function, and they access |
263 // this data via this reference member. | 264 // this data via this reference member. |
264 const FilterContext& filter_context_; | 265 const FilterContext& filter_context_; |
265 | 266 |
266 DISALLOW_COPY_AND_ASSIGN(Filter); | 267 DISALLOW_COPY_AND_ASSIGN(Filter); |
267 }; | 268 }; |
268 | 269 |
269 #endif // NET_BASE_FILTER_H__ | 270 #endif // NET_BASE_FILTER_H__ |
OLD | NEW |