OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
tfarina
2011/03/08 20:54:49
please, update the year through all the files you
adamk
2011/03/08 21:35:20
Done.
| |
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(); |
11 // pre_filter_source->read(filter->stream_buffer(), pre_filter_data_len); | 11 // pre_filter_source->read(filter->stream_buffer(), pre_filter_data_len); |
(...skipping 23 matching lines...) Expand all Loading... | |
35 | 35 |
36 #include "base/basictypes.h" | 36 #include "base/basictypes.h" |
37 #include "base/gtest_prod_util.h" | 37 #include "base/gtest_prod_util.h" |
38 #include "base/ref_counted.h" | 38 #include "base/ref_counted.h" |
39 #include "base/scoped_ptr.h" | 39 #include "base/scoped_ptr.h" |
40 #include "base/time.h" | 40 #include "base/time.h" |
41 | 41 |
42 class GURL; | 42 class GURL; |
43 | 43 |
44 namespace net { | 44 namespace net { |
45 | |
45 class IOBuffer; | 46 class IOBuffer; |
46 class SdchFilterChainingTest; | |
47 } | |
48 | 47 |
49 //------------------------------------------------------------------------------ | 48 //------------------------------------------------------------------------------ |
50 // Define an interface class that allows access to contextual information | 49 // Define an interface class that allows access to contextual information |
51 // supplied by the owner of this filter. In the case where there are a chain of | 50 // supplied by the owner of this filter. In the case where there are a chain of |
52 // filters, there is only one owner of all the chained filters, and that context | 51 // filters, there is only one owner of all the chained filters, and that context |
53 // is passed to the constructor of all those filters. To be clear, the context | 52 // is passed to the constructor of all those filters. To be clear, the context |
54 // does NOT reflect the position in a chain, or the fact that there are prior | 53 // does NOT reflect the position in a chain, or the fact that there are prior |
55 // or later filters in a chain. | 54 // or later filters in a chain. |
56 class FilterContext { | 55 class FilterContext { |
57 public: | 56 public: |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 // redundant gzip encoding is specified), as well as issues regarding SDCH | 186 // redundant gzip encoding is specified), as well as issues regarding SDCH |
188 // encoding, where various proxies and anti-virus products modify or strip the | 187 // encoding, where various proxies and anti-virus products modify or strip the |
189 // encodings. These fixups require context, which includes whether this | 188 // encodings. These fixups require context, which includes whether this |
190 // response was made to an SDCH request (i.e., an available dictionary was | 189 // response was made to an SDCH request (i.e., an available dictionary was |
191 // advertised in the GET), as well as the mime type of the content. | 190 // advertised in the GET), as well as the mime type of the content. |
192 static void FixupEncodingTypes(const FilterContext& filter_context, | 191 static void FixupEncodingTypes(const FilterContext& filter_context, |
193 std::vector<FilterType>* encoding_types); | 192 std::vector<FilterType>* encoding_types); |
194 | 193 |
195 protected: | 194 protected: |
196 friend class GZipUnitTest; | 195 friend class GZipUnitTest; |
197 friend class net::SdchFilterChainingTest; | 196 friend class SdchFilterChainingTest; |
198 | 197 |
199 explicit Filter(const FilterContext& filter_context); | 198 explicit Filter(const FilterContext& filter_context); |
200 | 199 |
201 // Filters the data stored in stream_buffer_ and writes the output into the | 200 // Filters the data stored in stream_buffer_ and writes the output into the |
202 // dest_buffer passed in. | 201 // dest_buffer passed in. |
203 // | 202 // |
204 // Upon entry, *dest_len is the total size (in number of chars) of the | 203 // Upon entry, *dest_len is the total size (in number of chars) of the |
205 // destination buffer. Upon exit, *dest_len is the actual number of chars | 204 // destination buffer. Upon exit, *dest_len is the actual number of chars |
206 // written into the destination buffer. | 205 // written into the destination buffer. |
207 // | 206 // |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 FilterStatus last_status_; | 259 FilterStatus last_status_; |
261 | 260 |
262 // Context data from the owner of this filter. Some filters need additional | 261 // Context data from the owner of this filter. Some filters need additional |
263 // context information (mime type, etc.) to properly function, and they access | 262 // context information (mime type, etc.) to properly function, and they access |
264 // this data via this reference member. | 263 // this data via this reference member. |
265 const FilterContext& filter_context_; | 264 const FilterContext& filter_context_; |
266 | 265 |
267 DISALLOW_COPY_AND_ASSIGN(Filter); | 266 DISALLOW_COPY_AND_ASSIGN(Filter); |
268 }; | 267 }; |
269 | 268 |
269 } // namespace net | |
270 | |
270 #endif // NET_BASE_FILTER_H__ | 271 #endif // NET_BASE_FILTER_H__ |
OLD | NEW |