| 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 "webkit/glue/multipart_response_delegate.h" | 5 #include "webkit/glue/multipart_response_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 data_ = data_.substr(line_end_pos); | 241 data_ = data_.substr(line_end_pos); |
| 242 | 242 |
| 243 // Create a WebURLResponse based on the original set of headers + the | 243 // Create a WebURLResponse based on the original set of headers + the |
| 244 // replacement headers. We only replace the same few headers that gecko | 244 // replacement headers. We only replace the same few headers that gecko |
| 245 // does. See netwerk/streamconv/converters/nsMultiMixedConv.cpp. | 245 // does. See netwerk/streamconv/converters/nsMultiMixedConv.cpp. |
| 246 std::string content_type = net::GetSpecificHeader(headers, "content-type"); | 246 std::string content_type = net::GetSpecificHeader(headers, "content-type"); |
| 247 std::string mime_type; | 247 std::string mime_type; |
| 248 std::string charset; | 248 std::string charset; |
| 249 bool has_charset = false; | 249 bool has_charset = false; |
| 250 net::HttpUtil::ParseContentType(content_type, &mime_type, &charset, | 250 net::HttpUtil::ParseContentType(content_type, &mime_type, &charset, |
| 251 &has_charset); | 251 &has_charset, NULL); |
| 252 WebURLResponse response(original_response_.url()); | 252 WebURLResponse response(original_response_.url()); |
| 253 response.setMIMEType(WebString::fromUTF8(mime_type)); | 253 response.setMIMEType(WebString::fromUTF8(mime_type)); |
| 254 response.setTextEncodingName(WebString::fromUTF8(charset)); | 254 response.setTextEncodingName(WebString::fromUTF8(charset)); |
| 255 | 255 |
| 256 HeaderCopier copier(&response); | 256 HeaderCopier copier(&response); |
| 257 original_response_.visitHTTPHeaderFields(&copier); | 257 original_response_.visitHTTPHeaderFields(&copier); |
| 258 | 258 |
| 259 for (size_t i = 0; i < arraysize(kReplaceHeaders); ++i) { | 259 for (size_t i = 0; i < arraysize(kReplaceHeaders); ++i) { |
| 260 std::string name(kReplaceHeaders[i]); | 260 std::string name(kReplaceHeaders[i]); |
| 261 std::string value = net::GetSpecificHeader(headers, name); | 261 std::string value = net::GetSpecificHeader(headers, name); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 if (!base::StringToInt64(byte_range_upper_bound, content_range_upper_bound)) | 395 if (!base::StringToInt64(byte_range_upper_bound, content_range_upper_bound)) |
| 396 return false; | 396 return false; |
| 397 if (!base::StringToInt64(byte_range_instance_size, | 397 if (!base::StringToInt64(byte_range_instance_size, |
| 398 content_range_instance_size)) { | 398 content_range_instance_size)) { |
| 399 return false; | 399 return false; |
| 400 } | 400 } |
| 401 return true; | 401 return true; |
| 402 } | 402 } |
| 403 | 403 |
| 404 } // namespace webkit_glue | 404 } // namespace webkit_glue |
| OLD | NEW |