| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 18 matching lines...) Expand all Loading... |
| 29 // Mime types: | 29 // Mime types: |
| 30 const char kApplicationXGzip[] = "application/x-gzip"; | 30 const char kApplicationXGzip[] = "application/x-gzip"; |
| 31 const char kApplicationGzip[] = "application/gzip"; | 31 const char kApplicationGzip[] = "application/gzip"; |
| 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 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 FilterContext::~FilterContext() { |
| 40 } |
| 41 |
| 39 Filter* Filter::Factory(const std::vector<FilterType>& filter_types, | 42 Filter* Filter::Factory(const std::vector<FilterType>& filter_types, |
| 40 const FilterContext& filter_context) { | 43 const FilterContext& filter_context) { |
| 41 DCHECK_GT(filter_context.GetInputStreamBufferSize(), 0); | 44 DCHECK_GT(filter_context.GetInputStreamBufferSize(), 0); |
| 42 if (filter_types.empty() || filter_context.GetInputStreamBufferSize() <= 0) | 45 if (filter_types.empty() || filter_context.GetInputStreamBufferSize() <= 0) |
| 43 return NULL; | 46 return NULL; |
| 44 | 47 |
| 45 | 48 |
| 46 Filter* filter_list = NULL; // Linked list of filters. | 49 Filter* filter_list = NULL; // Linked list of filters. |
| 47 for (size_t i = 0; i < filter_types.size(); i++) { | 50 for (size_t i = 0; i < filter_types.size(); i++) { |
| 48 filter_list = PrependNewFilter(filter_types[i], filter_context, | 51 filter_list = PrependNewFilter(filter_types[i], filter_context, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 384 |
| 382 DCHECK(stream_buffer()); | 385 DCHECK(stream_buffer()); |
| 383 // Bail out if there is more data in the stream buffer to be filtered. | 386 // Bail out if there is more data in the stream buffer to be filtered. |
| 384 if (!stream_buffer() || stream_data_len_) | 387 if (!stream_buffer() || stream_data_len_) |
| 385 return false; | 388 return false; |
| 386 | 389 |
| 387 next_stream_data_ = stream_buffer()->data(); | 390 next_stream_data_ = stream_buffer()->data(); |
| 388 stream_data_len_ = stream_data_len; | 391 stream_data_len_ = stream_data_len; |
| 389 return true; | 392 return true; |
| 390 } | 393 } |
| OLD | NEW |