OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef NET_FILTER_FILTER_SOURCE_STREAM_H_ | 5 #ifndef NET_FILTER_FILTER_SOURCE_STREAM_H_ |
6 #define NET_FILTER_FILTER_SOURCE_STREAM_H_ | 6 #define NET_FILTER_FILTER_SOURCE_STREAM_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 FilterSourceStream(SourceType type, std::unique_ptr<SourceStream> upstream); | 31 FilterSourceStream(SourceType type, std::unique_ptr<SourceStream> upstream); |
32 | 32 |
33 ~FilterSourceStream() override; | 33 ~FilterSourceStream() override; |
34 | 34 |
35 int Read(IOBuffer* read_buffer, | 35 int Read(IOBuffer* read_buffer, |
36 int read_buffer_size, | 36 int read_buffer_size, |
37 const CompletionCallback& callback) override; | 37 const CompletionCallback& callback) override; |
38 | 38 |
39 std::string Description() const override; | 39 std::string Description() const override; |
40 | 40 |
| 41 static SourceType ParseEncodingType(const std::string& encoding); |
| 42 |
| 43 static void ReportContentDecodingFailed(SourceType type); |
| 44 |
41 private: | 45 private: |
42 enum State { | 46 enum State { |
43 STATE_NONE, | 47 STATE_NONE, |
44 // Reading data from |upstream_| into |input_buffer_|. | 48 // Reading data from |upstream_| into |input_buffer_|. |
45 STATE_READ_DATA, | 49 STATE_READ_DATA, |
46 // Reading data from |upstream_| completed. | 50 // Reading data from |upstream_| completed. |
47 STATE_READ_DATA_COMPLETE, | 51 STATE_READ_DATA_COMPLETE, |
48 // Filtering data contained in |input_buffer_|. | 52 // Filtering data contained in |input_buffer_|. |
49 STATE_FILTER_DATA, | 53 STATE_FILTER_DATA, |
50 // Filtering data contained in |input_buffer_| completed. | 54 // Filtering data contained in |input_buffer_| completed. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 114 |
111 // Reading from |upstream_| has returned 0 byte or an error code. | 115 // Reading from |upstream_| has returned 0 byte or an error code. |
112 bool upstream_end_reached_; | 116 bool upstream_end_reached_; |
113 | 117 |
114 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream); | 118 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream); |
115 }; | 119 }; |
116 | 120 |
117 } // namespace net | 121 } // namespace net |
118 | 122 |
119 #endif // NET_FILTER_FILTER_SOURCE_STREAM_H_ | 123 #endif // NET_FILTER_FILTER_SOURCE_STREAM_H_ |
OLD | NEW |