| 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 // std::unique_ptr<Filter> filter = Filter::Factory(filter_type, size); | 9 // std::unique_ptr<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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "base/macros.h" | 56 #include "base/macros.h" |
| 57 #include "base/memory/ref_counted.h" | 57 #include "base/memory/ref_counted.h" |
| 58 #include "base/time/time.h" | 58 #include "base/time/time.h" |
| 59 #include "net/base/net_export.h" | 59 #include "net/base/net_export.h" |
| 60 #include "net/base/sdch_manager.h" | 60 #include "net/base/sdch_manager.h" |
| 61 | 61 |
| 62 class GURL; | 62 class GURL; |
| 63 | 63 |
| 64 namespace net { | 64 namespace net { |
| 65 | 65 |
| 66 class BoundNetLog; | 66 class NetLogWithSource; |
| 67 class IOBuffer; | 67 class IOBuffer; |
| 68 class URLRequestContext; | 68 class URLRequestContext; |
| 69 | 69 |
| 70 //------------------------------------------------------------------------------ | 70 //------------------------------------------------------------------------------ |
| 71 // Define an interface class that allows access to contextual information | 71 // Define an interface class that allows access to contextual information |
| 72 // supplied by the owner of this filter. In the case where there are a chain of | 72 // supplied by the owner of this filter. In the case where there are a chain of |
| 73 // filters, there is only one owner of all the chained filters, and that context | 73 // filters, there is only one owner of all the chained filters, and that context |
| 74 // is passed to the constructor of all those filters. To be clear, the context | 74 // is passed to the constructor of all those filters. To be clear, the context |
| 75 // does NOT reflect the position in a chain, or the fact that there are prior | 75 // does NOT reflect the position in a chain, or the fact that there are prior |
| 76 // or later filters in a chain. | 76 // or later filters in a chain. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // For example: 200 is ok. 4xx are error codes. etc. | 121 // For example: 200 is ok. 4xx are error codes. etc. |
| 122 virtual int GetResponseCode() const = 0; | 122 virtual int GetResponseCode() const = 0; |
| 123 | 123 |
| 124 // The URLRequestContext associated with the request. | 124 // The URLRequestContext associated with the request. |
| 125 virtual const URLRequestContext* GetURLRequestContext() const = 0; | 125 virtual const URLRequestContext* GetURLRequestContext() const = 0; |
| 126 | 126 |
| 127 // The following method forces the context to emit a specific set of | 127 // The following method forces the context to emit a specific set of |
| 128 // statistics as selected by the argument. | 128 // statistics as selected by the argument. |
| 129 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; | 129 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
| 130 | 130 |
| 131 // The BoundNetLog of the associated request. | 131 // The NetLogWithSource of the associated request. |
| 132 virtual const BoundNetLog& GetNetLog() const = 0; | 132 virtual const NetLogWithSource& GetNetLog() const = 0; |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 //------------------------------------------------------------------------------ | 135 //------------------------------------------------------------------------------ |
| 136 class NET_EXPORT Filter { | 136 class NET_EXPORT Filter { |
| 137 public: | 137 public: |
| 138 // Return values of function ReadFilteredData. | 138 // Return values of function ReadFilteredData. |
| 139 enum FilterStatus { | 139 enum FilterStatus { |
| 140 // Read filtered data successfully | 140 // Read filtered data successfully |
| 141 FILTER_OK, | 141 FILTER_OK, |
| 142 // Read filtered data successfully, and the data in the buffer has been | 142 // Read filtered data successfully, and the data in the buffer has been |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 // The filter type this filter was constructed from. | 323 // The filter type this filter was constructed from. |
| 324 FilterType type_id_; | 324 FilterType type_id_; |
| 325 | 325 |
| 326 DISALLOW_COPY_AND_ASSIGN(Filter); | 326 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 } // namespace net | 329 } // namespace net |
| 330 | 330 |
| 331 #endif // NET_FILTER_FILTER_H__ | 331 #endif // NET_FILTER_FILTER_H__ |
| OLD | NEW |