OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/blob/blob_url_request_job.h" | 5 #include "webkit/blob/blob_url_request_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/http/http_request_headers.h" | 16 #include "net/http/http_request_headers.h" |
17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
18 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
19 #include "net/http/http_util.h" | 19 #include "net/http/http_util.h" |
20 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 21 #include "net/url_request/url_request_context.h" |
21 #include "net/url_request/url_request_error_job.h" | 22 #include "net/url_request/url_request_error_job.h" |
22 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
23 #include "webkit/blob/local_file_stream_reader.h" | 24 #include "webkit/blob/local_file_stream_reader.h" |
24 | 25 |
25 namespace webkit_blob { | 26 namespace webkit_blob { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 const int kHTTPOk = 200; | 30 const int kHTTPOk = 200; |
30 const int kHTTPPartialContent = 206; | 31 const int kHTTPPartialContent = 206; |
(...skipping 11 matching lines...) Expand all Loading... |
42 const char kHTTPRequestedRangeNotSatisfiableText[] = | 43 const char kHTTPRequestedRangeNotSatisfiableText[] = |
43 "Requested Range Not Satisfiable"; | 44 "Requested Range Not Satisfiable"; |
44 const char kHTTPInternalErrorText[] = "Internal Server Error"; | 45 const char kHTTPInternalErrorText[] = "Internal Server Error"; |
45 | 46 |
46 } // namespace | 47 } // namespace |
47 | 48 |
48 BlobURLRequestJob::BlobURLRequestJob( | 49 BlobURLRequestJob::BlobURLRequestJob( |
49 net::URLRequest* request, | 50 net::URLRequest* request, |
50 BlobData* blob_data, | 51 BlobData* blob_data, |
51 base::MessageLoopProxy* file_thread_proxy) | 52 base::MessageLoopProxy* file_thread_proxy) |
52 : net::URLRequestJob(request), | 53 : net::URLRequestJob(request, request->context()->network_delegate()), |
53 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 54 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
54 blob_data_(blob_data), | 55 blob_data_(blob_data), |
55 file_thread_proxy_(file_thread_proxy), | 56 file_thread_proxy_(file_thread_proxy), |
56 total_size_(0), | 57 total_size_(0), |
57 remaining_bytes_(0), | 58 remaining_bytes_(0), |
58 pending_get_file_info_count_(0), | 59 pending_get_file_info_count_(0), |
59 current_item_index_(0), | 60 current_item_index_(0), |
60 current_item_offset_(0), | 61 current_item_offset_(0), |
61 error_(false), | 62 error_(false), |
62 headers_set_(false), | 63 headers_set_(false), |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 file_thread_proxy_, | 534 file_thread_proxy_, |
534 item.file_path, | 535 item.file_path, |
535 item.offset, | 536 item.offset, |
536 item.expected_modification_time); | 537 item.expected_modification_time); |
537 } | 538 } |
538 DCHECK(index_to_reader_[index]); | 539 DCHECK(index_to_reader_[index]); |
539 return index_to_reader_[index]; | 540 return index_to_reader_[index]; |
540 } | 541 } |
541 | 542 |
542 } // namespace webkit_blob | 543 } // namespace webkit_blob |
OLD | NEW |