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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/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" |
11 #include "net/base/mime_util.h" | 11 #include "net/base/mime_util.h" |
12 #include "net/base/sdch_filter.h" | 12 #include "net/base/sdch_filter.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Filter types (using canonical lower case only): | 16 // Filter types (using canonical lower case only): |
17 const char kDeflate[] = "deflate"; | 17 const char kDeflate[] = "deflate"; |
18 const char kGZip[] = "gzip"; | 18 const char kGZip[] = "gzip"; |
19 const char kXGZip[] = "x-gzip"; | 19 const char kXGZip[] = "x-gzip"; |
20 const char kSdch[] = "sdch"; | 20 const char kSdch[] = "sdch"; |
21 // compress and x-compress are currently not supported. If we decide to support | 21 // compress and x-compress are currently not supported. If we decide to support |
22 // them, we'll need the same mime type compatibility hack we have for gzip. For | 22 // them, we'll need the same mime type compatibility hack we have for gzip. For |
23 // more information, see Firefox's nsHttpChannel::ProcessNormal. | 23 // more information, see Firefox's nsHttpChannel::ProcessNormal. |
24 const char kCompress[] = "compress"; | |
25 const char kXCompress[] = "x-compress"; | |
26 const char kIdentity[] = "identity"; | |
27 const char kUncompressed[] = "uncompressed"; | |
28 | 24 |
29 // Mime types: | 25 // Mime types: |
30 const char kApplicationXGzip[] = "application/x-gzip"; | 26 const char kApplicationXGzip[] = "application/x-gzip"; |
31 const char kApplicationGzip[] = "application/gzip"; | 27 const char kApplicationGzip[] = "application/gzip"; |
32 const char kApplicationXGunzip[] = "application/x-gunzip"; | 28 const char kApplicationXGunzip[] = "application/x-gunzip"; |
33 const char kApplicationXCompress[] = "application/x-compress"; | |
34 const char kApplicationCompress[] = "application/compress"; | |
35 const char kTextHtml[] = "text/html"; | 29 const char kTextHtml[] = "text/html"; |
36 | 30 |
37 // Buffer size allocated when de-compressing data. | 31 // Buffer size allocated when de-compressing data. |
38 const int kFilterBufSize = 32 * 1024; | 32 const int kFilterBufSize = 32 * 1024; |
39 | 33 |
40 } // namespace | 34 } // namespace |
41 | 35 |
42 namespace net { | 36 namespace net { |
43 | 37 |
44 FilterContext::~FilterContext() { | 38 FilterContext::~FilterContext() { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 391 |
398 void Filter::PushDataIntoNextFilter() { | 392 void Filter::PushDataIntoNextFilter() { |
399 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 393 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
400 int next_size = next_filter_->stream_buffer_size(); | 394 int next_size = next_filter_->stream_buffer_size(); |
401 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 395 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
402 if (FILTER_ERROR != last_status_) | 396 if (FILTER_ERROR != last_status_) |
403 next_filter_->FlushStreamBuffer(next_size); | 397 next_filter_->FlushStreamBuffer(next_size); |
404 } | 398 } |
405 | 399 |
406 } // namespace net | 400 } // namespace net |
OLD | NEW |