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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "base/gtest_prod_util.h" | 53 #include "base/gtest_prod_util.h" |
54 #include "base/memory/ref_counted.h" | 54 #include "base/memory/ref_counted.h" |
55 #include "base/memory/scoped_ptr.h" | 55 #include "base/memory/scoped_ptr.h" |
56 #include "base/time/time.h" | 56 #include "base/time/time.h" |
57 #include "net/base/net_export.h" | 57 #include "net/base/net_export.h" |
58 | 58 |
59 class GURL; | 59 class GURL; |
60 | 60 |
61 namespace net { | 61 namespace net { |
62 | 62 |
63 class BoundNetLog; | 63 class URLRequestContext; |
64 class IOBuffer; | 64 class IOBuffer; |
65 class URLRequestContext; | |
66 | 65 |
67 //------------------------------------------------------------------------------ | 66 //------------------------------------------------------------------------------ |
68 // Define an interface class that allows access to contextual information | 67 // Define an interface class that allows access to contextual information |
69 // supplied by the owner of this filter. In the case where there are a chain of | 68 // supplied by the owner of this filter. In the case where there are a chain of |
70 // filters, there is only one owner of all the chained filters, and that context | 69 // filters, there is only one owner of all the chained filters, and that context |
71 // is passed to the constructor of all those filters. To be clear, the context | 70 // is passed to the constructor of all those filters. To be clear, the context |
72 // does NOT reflect the position in a chain, or the fact that there are prior | 71 // does NOT reflect the position in a chain, or the fact that there are prior |
73 // or later filters in a chain. | 72 // or later filters in a chain. |
74 class NET_EXPORT_PRIVATE FilterContext { | 73 class NET_EXPORT_PRIVATE FilterContext { |
75 public: | 74 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // What response code was received with the associated network transaction? | 115 // What response code was received with the associated network transaction? |
117 // For example: 200 is ok. 4xx are error codes. etc. | 116 // For example: 200 is ok. 4xx are error codes. etc. |
118 virtual int GetResponseCode() const = 0; | 117 virtual int GetResponseCode() const = 0; |
119 | 118 |
120 // The URLRequestContext associated with the request. | 119 // The URLRequestContext associated with the request. |
121 virtual const URLRequestContext* GetURLRequestContext() const = 0; | 120 virtual const URLRequestContext* GetURLRequestContext() const = 0; |
122 | 121 |
123 // The following method forces the context to emit a specific set of | 122 // The following method forces the context to emit a specific set of |
124 // statistics as selected by the argument. | 123 // statistics as selected by the argument. |
125 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; | 124 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
126 | |
127 // The BoundNetLog of the associated request. | |
128 virtual const BoundNetLog& GetNetLog() const = 0; | |
129 }; | 125 }; |
130 | 126 |
131 //------------------------------------------------------------------------------ | 127 //------------------------------------------------------------------------------ |
132 class NET_EXPORT_PRIVATE Filter { | 128 class NET_EXPORT_PRIVATE Filter { |
133 public: | 129 public: |
134 // Return values of function ReadFilteredData. | 130 // Return values of function ReadFilteredData. |
135 enum FilterStatus { | 131 enum FilterStatus { |
136 // Read filtered data successfully | 132 // Read filtered data successfully |
137 FILTER_OK, | 133 FILTER_OK, |
138 // Read filtered data successfully, and the data in the buffer has been | 134 // Read filtered data successfully, and the data in the buffer has been |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Remember what status or local filter last returned so we can better handle | 293 // Remember what status or local filter last returned so we can better handle |
298 // chained filters. | 294 // chained filters. |
299 FilterStatus last_status_; | 295 FilterStatus last_status_; |
300 | 296 |
301 DISALLOW_COPY_AND_ASSIGN(Filter); | 297 DISALLOW_COPY_AND_ASSIGN(Filter); |
302 }; | 298 }; |
303 | 299 |
304 } // namespace net | 300 } // namespace net |
305 | 301 |
306 #endif // NET_FILTER_FILTER_H__ | 302 #endif // NET_FILTER_FILTER_H__ |
OLD | NEW |