OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/base/filter.h" | 5 #include "net/base/filter.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "net/base/gzip_filter.h" | 9 #include "net/base/gzip_filter.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 const char kApplicationXGunzip[] = "application/x-gunzip"; | 32 const char kApplicationXGunzip[] = "application/x-gunzip"; |
33 const char kApplicationXCompress[] = "application/x-compress"; | 33 const char kApplicationXCompress[] = "application/x-compress"; |
34 const char kApplicationCompress[] = "application/compress"; | 34 const char kApplicationCompress[] = "application/compress"; |
35 const char kTextHtml[] = "text/html"; | 35 const char kTextHtml[] = "text/html"; |
36 | 36 |
37 // Buffer size allocated when de-compressing data. | 37 // Buffer size allocated when de-compressing data. |
38 const int kFilterBufSize = 32 * 1024; | 38 const int kFilterBufSize = 32 * 1024; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
| 42 namespace net { |
| 43 |
42 FilterContext::~FilterContext() { | 44 FilterContext::~FilterContext() { |
43 } | 45 } |
44 | 46 |
45 Filter::~Filter() {} | 47 Filter::~Filter() {} |
46 | 48 |
47 Filter* Filter::Factory(const std::vector<FilterType>& filter_types, | 49 Filter* Filter::Factory(const std::vector<FilterType>& filter_types, |
48 const FilterContext& filter_context) { | 50 const FilterContext& filter_context) { |
49 if (filter_types.empty()) | 51 if (filter_types.empty()) |
50 return NULL; | 52 return NULL; |
51 | 53 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 stream_buffer_size_ = buffer_size; | 395 stream_buffer_size_ = buffer_size; |
394 } | 396 } |
395 | 397 |
396 void Filter::PushDataIntoNextFilter() { | 398 void Filter::PushDataIntoNextFilter() { |
397 net::IOBuffer* next_buffer = next_filter_->stream_buffer(); | 399 net::IOBuffer* next_buffer = next_filter_->stream_buffer(); |
398 int next_size = next_filter_->stream_buffer_size(); | 400 int next_size = next_filter_->stream_buffer_size(); |
399 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 401 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
400 if (FILTER_ERROR != last_status_) | 402 if (FILTER_ERROR != last_status_) |
401 next_filter_->FlushStreamBuffer(next_size); | 403 next_filter_->FlushStreamBuffer(next_size); |
402 } | 404 } |
| 405 |
| 406 } // namespace net |
OLD | NEW |