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 // 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 25 matching lines...) Expand all Loading... |
36 #include "base/gtest_prod_util.h" | 36 #include "base/gtest_prod_util.h" |
37 #include "base/memory/ref_counted.h" | 37 #include "base/memory/ref_counted.h" |
38 #include "base/memory/scoped_ptr.h" | 38 #include "base/memory/scoped_ptr.h" |
39 #include "base/time/time.h" | 39 #include "base/time/time.h" |
40 #include "net/base/net_export.h" | 40 #include "net/base/net_export.h" |
41 | 41 |
42 class GURL; | 42 class GURL; |
43 | 43 |
44 namespace net { | 44 namespace net { |
45 | 45 |
| 46 class URLRequestContext; |
46 class IOBuffer; | 47 class IOBuffer; |
47 | 48 |
48 //------------------------------------------------------------------------------ | 49 //------------------------------------------------------------------------------ |
49 // Define an interface class that allows access to contextual information | 50 // Define an interface class that allows access to contextual information |
50 // supplied by the owner of this filter. In the case where there are a chain of | 51 // supplied by the owner of this filter. In the case where there are a chain of |
51 // filters, there is only one owner of all the chained filters, and that context | 52 // filters, there is only one owner of all the chained filters, and that context |
52 // is passed to the constructor of all those filters. To be clear, the context | 53 // is passed to the constructor of all those filters. To be clear, the context |
53 // does NOT reflect the position in a chain, or the fact that there are prior | 54 // does NOT reflect the position in a chain, or the fact that there are prior |
54 // or later filters in a chain. | 55 // or later filters in a chain. |
55 class NET_EXPORT_PRIVATE FilterContext { | 56 class NET_EXPORT_PRIVATE FilterContext { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual bool IsSdchResponse() const = 0; | 92 virtual bool IsSdchResponse() const = 0; |
92 | 93 |
93 // How many bytes were read from the net or cache so far (and potentially | 94 // How many bytes were read from the net or cache so far (and potentially |
94 // pushed into a filter for processing)? | 95 // pushed into a filter for processing)? |
95 virtual int64 GetByteReadCount() const = 0; | 96 virtual int64 GetByteReadCount() const = 0; |
96 | 97 |
97 // What response code was received with the associated network transaction? | 98 // What response code was received with the associated network transaction? |
98 // For example: 200 is ok. 4xx are error codes. etc. | 99 // For example: 200 is ok. 4xx are error codes. etc. |
99 virtual int GetResponseCode() const = 0; | 100 virtual int GetResponseCode() const = 0; |
100 | 101 |
| 102 // The URLRequestContext associated with the request. |
| 103 virtual const URLRequestContext* GetURLRequestContext() const = 0; |
| 104 |
101 // The following method forces the context to emit a specific set of | 105 // The following method forces the context to emit a specific set of |
102 // statistics as selected by the argument. | 106 // statistics as selected by the argument. |
103 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; | 107 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
104 }; | 108 }; |
105 | 109 |
106 //------------------------------------------------------------------------------ | 110 //------------------------------------------------------------------------------ |
107 class NET_EXPORT_PRIVATE Filter { | 111 class NET_EXPORT_PRIVATE Filter { |
108 public: | 112 public: |
109 // Return values of function ReadFilteredData. | 113 // Return values of function ReadFilteredData. |
110 enum FilterStatus { | 114 enum FilterStatus { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // Remember what status or local filter last returned so we can better handle | 275 // Remember what status or local filter last returned so we can better handle |
272 // chained filters. | 276 // chained filters. |
273 FilterStatus last_status_; | 277 FilterStatus last_status_; |
274 | 278 |
275 DISALLOW_COPY_AND_ASSIGN(Filter); | 279 DISALLOW_COPY_AND_ASSIGN(Filter); |
276 }; | 280 }; |
277 | 281 |
278 } // namespace net | 282 } // namespace net |
279 | 283 |
280 #endif // NET_FILTER_FILTER_H__ | 284 #endif // NET_FILTER_FILTER_H__ |
OLD | NEW |