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