| 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_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "net/base/upload_data_stream.h" | |
| 10 #include "net/url_request/url_fetcher_core.h" | 9 #include "net/url_request/url_fetcher_core.h" |
| 11 #include "net/url_request/url_fetcher_factory.h" | 10 #include "net/url_request/url_fetcher_factory.h" |
| 12 | 11 |
| 13 namespace net { | 12 namespace net { |
| 14 | 13 |
| 15 static URLFetcherFactory* g_factory = NULL; | 14 static URLFetcherFactory* g_factory = NULL; |
| 16 | 15 |
| 17 URLFetcherImpl::URLFetcherImpl(const GURL& url, | 16 URLFetcherImpl::URLFetcherImpl(const GURL& url, |
| 18 RequestType request_type, | 17 RequestType request_type, |
| 19 URLFetcherDelegate* d) | 18 URLFetcherDelegate* d) |
| 20 : ALLOW_THIS_IN_INITIALIZER_LIST( | 19 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 21 core_(new URLFetcherCore(this, url, request_type, d))) { | 20 core_(new URLFetcherCore(this, url, request_type, d))) { |
| 22 } | 21 } |
| 23 | 22 |
| 24 URLFetcherImpl::~URLFetcherImpl() { | 23 URLFetcherImpl::~URLFetcherImpl() { |
| 25 core_->Stop(); | 24 core_->Stop(); |
| 26 } | 25 } |
| 27 | 26 |
| 28 void URLFetcherImpl::SetUploadDataStream( | |
| 29 const std::string& upload_content_type, | |
| 30 scoped_ptr<UploadDataStream> upload_content) { | |
| 31 core_->SetUploadDataStream(upload_content_type, upload_content.Pass()); | |
| 32 } | |
| 33 | |
| 34 void URLFetcherImpl::SetUploadData(const std::string& upload_content_type, | 27 void URLFetcherImpl::SetUploadData(const std::string& upload_content_type, |
| 35 const std::string& upload_content) { | 28 const std::string& upload_content) { |
| 36 core_->SetUploadData(upload_content_type, upload_content); | 29 core_->SetUploadData(upload_content_type, upload_content); |
| 37 } | 30 } |
| 38 | 31 |
| 39 void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) { | 32 void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) { |
| 40 core_->SetChunkedUpload(content_type); | 33 core_->SetChunkedUpload(content_type); |
| 41 } | 34 } |
| 42 | 35 |
| 43 void URLFetcherImpl::AppendChunkToUpload(const std::string& data, | 36 void URLFetcherImpl::AppendChunkToUpload(const std::string& data, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 URLFetcherFactory* URLFetcherImpl::factory() { | 201 URLFetcherFactory* URLFetcherImpl::factory() { |
| 209 return g_factory; | 202 return g_factory; |
| 210 } | 203 } |
| 211 | 204 |
| 212 // static | 205 // static |
| 213 void URLFetcherImpl::set_factory(URLFetcherFactory* factory) { | 206 void URLFetcherImpl::set_factory(URLFetcherFactory* factory) { |
| 214 g_factory = factory; | 207 g_factory = factory; |
| 215 } | 208 } |
| 216 | 209 |
| 217 } // namespace net | 210 } // namespace net |
| OLD | NEW |