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