| 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 BoundNetLog; |
| 47 class IOBuffer; |
| 46 class URLRequestContext; | 48 class URLRequestContext; |
| 47 class IOBuffer; | |
| 48 | 49 |
| 49 //------------------------------------------------------------------------------ | 50 //------------------------------------------------------------------------------ |
| 50 // Define an interface class that allows access to contextual information | 51 // 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 | 52 // 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 | 53 // 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 | 54 // 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 | 55 // does NOT reflect the position in a chain, or the fact that there are prior |
| 55 // or later filters in a chain. | 56 // or later filters in a chain. |
| 56 class NET_EXPORT_PRIVATE FilterContext { | 57 class NET_EXPORT_PRIVATE FilterContext { |
| 57 public: | 58 public: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // What response code was received with the associated network transaction? | 99 // What response code was received with the associated network transaction? |
| 99 // For example: 200 is ok. 4xx are error codes. etc. | 100 // For example: 200 is ok. 4xx are error codes. etc. |
| 100 virtual int GetResponseCode() const = 0; | 101 virtual int GetResponseCode() const = 0; |
| 101 | 102 |
| 102 // The URLRequestContext associated with the request. | 103 // The URLRequestContext associated with the request. |
| 103 virtual const URLRequestContext* GetURLRequestContext() const = 0; | 104 virtual const URLRequestContext* GetURLRequestContext() const = 0; |
| 104 | 105 |
| 105 // The following method forces the context to emit a specific set of | 106 // The following method forces the context to emit a specific set of |
| 106 // statistics as selected by the argument. | 107 // statistics as selected by the argument. |
| 107 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; | 108 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
| 109 |
| 110 // The BoundNetLog of the associated request. |
| 111 virtual const BoundNetLog& GetNetLog() const = 0; |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 //------------------------------------------------------------------------------ | 114 //------------------------------------------------------------------------------ |
| 111 class NET_EXPORT_PRIVATE Filter { | 115 class NET_EXPORT_PRIVATE Filter { |
| 112 public: | 116 public: |
| 113 // Return values of function ReadFilteredData. | 117 // Return values of function ReadFilteredData. |
| 114 enum FilterStatus { | 118 enum FilterStatus { |
| 115 // Read filtered data successfully | 119 // Read filtered data successfully |
| 116 FILTER_OK, | 120 FILTER_OK, |
| 117 // Read filtered data successfully, and the data in the buffer has been | 121 // Read filtered data successfully, and the data in the buffer has been |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Remember what status or local filter last returned so we can better handle | 279 // Remember what status or local filter last returned so we can better handle |
| 276 // chained filters. | 280 // chained filters. |
| 277 FilterStatus last_status_; | 281 FilterStatus last_status_; |
| 278 | 282 |
| 279 DISALLOW_COPY_AND_ASSIGN(Filter); | 283 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 280 }; | 284 }; |
| 281 | 285 |
| 282 } // namespace net | 286 } // namespace net |
| 283 | 287 |
| 284 #endif // NET_FILTER_FILTER_H__ | 288 #endif // NET_FILTER_FILTER_H__ |
| OLD | NEW |