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 "net/url_request/url_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "net/base/upload_data_stream.h" |
10 #include "net/url_request/url_fetcher_core.h" | 11 #include "net/url_request/url_fetcher_core.h" |
11 #include "net/url_request/url_fetcher_factory.h" | 12 #include "net/url_request/url_fetcher_factory.h" |
12 #include "net/url_request/url_fetcher_response_writer.h" | 13 #include "net/url_request/url_fetcher_response_writer.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 static URLFetcherFactory* g_factory = NULL; | 17 static URLFetcherFactory* g_factory = NULL; |
17 | 18 |
18 URLFetcherImpl::URLFetcherImpl(const GURL& url, | 19 URLFetcherImpl::URLFetcherImpl(const GURL& url, |
19 RequestType request_type, | 20 RequestType request_type, |
(...skipping 16 matching lines...) Expand all Loading... |
36 uint64 range_offset, | 37 uint64 range_offset, |
37 uint64 range_length, | 38 uint64 range_length, |
38 scoped_refptr<base::TaskRunner> file_task_runner) { | 39 scoped_refptr<base::TaskRunner> file_task_runner) { |
39 core_->SetUploadFilePath(upload_content_type, | 40 core_->SetUploadFilePath(upload_content_type, |
40 file_path, | 41 file_path, |
41 range_offset, | 42 range_offset, |
42 range_length, | 43 range_length, |
43 file_task_runner); | 44 file_task_runner); |
44 } | 45 } |
45 | 46 |
| 47 void URLFetcherImpl::SetUploadStreamFactory( |
| 48 const std::string& upload_content_type, |
| 49 const CreateUploadStreamCallback& callback) { |
| 50 core_->SetUploadStreamFactory(upload_content_type, callback); |
| 51 } |
| 52 |
46 void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) { | 53 void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) { |
47 core_->SetChunkedUpload(content_type); | 54 core_->SetChunkedUpload(content_type); |
48 } | 55 } |
49 | 56 |
50 void URLFetcherImpl::AppendChunkToUpload(const std::string& data, | 57 void URLFetcherImpl::AppendChunkToUpload(const std::string& data, |
51 bool is_last_chunk) { | 58 bool is_last_chunk) { |
52 DCHECK(data.length()); | 59 DCHECK(data.length()); |
53 core_->AppendChunkToUpload(data, is_last_chunk); | 60 core_->AppendChunkToUpload(data, is_last_chunk); |
54 } | 61 } |
55 | 62 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 URLFetcherFactory* URLFetcherImpl::factory() { | 217 URLFetcherFactory* URLFetcherImpl::factory() { |
211 return g_factory; | 218 return g_factory; |
212 } | 219 } |
213 | 220 |
214 // static | 221 // static |
215 void URLFetcherImpl::set_factory(URLFetcherFactory* factory) { | 222 void URLFetcherImpl::set_factory(URLFetcherFactory* factory) { |
216 g_factory = factory; | 223 g_factory = factory; |
217 } | 224 } |
218 | 225 |
219 } // namespace net | 226 } // namespace net |
OLD | NEW |