OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/multipart_response_delegate.h" | 5 #include "content/child/multipart_response_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" |
8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
11 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
12 #include "net/http/http_response_headers.h" | 13 #include "net/http/http_response_headers.h" |
13 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
14 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 15 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
15 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
16 #include "third_party/WebKit/public/platform/WebURL.h" | 17 #include "third_party/WebKit/public/platform/WebURL.h" |
17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 18 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 content_type.substr(boundary_start_offset, boundary_length); | 309 content_type.substr(boundary_start_offset, boundary_length); |
309 // The byte range response can have quoted boundary strings. This is legal | 310 // The byte range response can have quoted boundary strings. This is legal |
310 // as per MIME specifications. Individual data fragements however don't | 311 // as per MIME specifications. Individual data fragements however don't |
311 // contain quoted boundary strings. | 312 // contain quoted boundary strings. |
312 base::TrimString(*multipart_boundary, "\"", multipart_boundary); | 313 base::TrimString(*multipart_boundary, "\"", multipart_boundary); |
313 return true; | 314 return true; |
314 } | 315 } |
315 | 316 |
316 bool MultipartResponseDelegate::ReadContentRanges( | 317 bool MultipartResponseDelegate::ReadContentRanges( |
317 const WebURLResponse& response, | 318 const WebURLResponse& response, |
318 int64* content_range_lower_bound, | 319 int64_t* content_range_lower_bound, |
319 int64* content_range_upper_bound, | 320 int64_t* content_range_upper_bound, |
320 int64* content_range_instance_size) { | 321 int64_t* content_range_instance_size) { |
321 | |
322 std::string content_range = response.httpHeaderField("Content-Range").utf8(); | 322 std::string content_range = response.httpHeaderField("Content-Range").utf8(); |
323 if (content_range.empty()) { | 323 if (content_range.empty()) { |
324 content_range = response.httpHeaderField("Range").utf8(); | 324 content_range = response.httpHeaderField("Range").utf8(); |
325 } | 325 } |
326 | 326 |
327 if (content_range.empty()) { | 327 if (content_range.empty()) { |
328 DLOG(WARNING) << "Failed to read content range from response."; | 328 DLOG(WARNING) << "Failed to read content range from response."; |
329 return false; | 329 return false; |
330 } | 330 } |
331 | 331 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if (!base::StringToInt64(byte_range_upper_bound, content_range_upper_bound)) | 385 if (!base::StringToInt64(byte_range_upper_bound, content_range_upper_bound)) |
386 return false; | 386 return false; |
387 if (!base::StringToInt64(byte_range_instance_size, | 387 if (!base::StringToInt64(byte_range_instance_size, |
388 content_range_instance_size)) { | 388 content_range_instance_size)) { |
389 return false; | 389 return false; |
390 } | 390 } |
391 return true; | 391 return true; |
392 } | 392 } |
393 | 393 |
394 } // namespace content | 394 } // namespace content |
OLD | NEW |