| 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 "remoting/host/url_fetcher.h" | 5 #include "remoting/host/url_fetcher.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // We are done. Post a task to call |done_callback_|. | 136 // We are done. Post a task to call |done_callback_|. |
| 137 delegate_message_loop_->PostTask( | 137 delegate_message_loop_->PostTask( |
| 138 FROM_HERE, base::Bind(&UrlFetcher::Core::CallCallback, this, status, | 138 FROM_HERE, base::Bind(&UrlFetcher::Core::CallCallback, this, status, |
| 139 request_->GetResponseCode())); | 139 request_->GetResponseCode())); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 void UrlFetcher::Core::DoStart() { | 143 void UrlFetcher::Core::DoStart() { |
| 144 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 144 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
| 145 | 145 |
| 146 request_.reset(new net::URLRequest(url_, this)); | 146 request_.reset(new net::URLRequest( |
| 147 request_->set_context(request_context_getter_->GetURLRequestContext()); | 147 url_, |
| 148 this, |
| 149 request_context_getter_->GetURLRequestContext())); |
| 148 | 150 |
| 149 switch (method_) { | 151 switch (method_) { |
| 150 case GET: | 152 case GET: |
| 151 break; | 153 break; |
| 152 | 154 |
| 153 case POST: | 155 case POST: |
| 154 DCHECK(!upload_content_.empty()); | 156 DCHECK(!upload_content_.empty()); |
| 155 DCHECK(!upload_content_type_.empty()); | 157 DCHECK(!upload_content_type_.empty()); |
| 156 request_->set_method("POST"); | 158 request_->set_method("POST"); |
| 157 | 159 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 213 |
| 212 void UrlFetcher::SetHeader(const std::string& key, const std::string& value) { | 214 void UrlFetcher::SetHeader(const std::string& key, const std::string& value) { |
| 213 core_->SetHeader(key, value); | 215 core_->SetHeader(key, value); |
| 214 } | 216 } |
| 215 | 217 |
| 216 void UrlFetcher::Start(const DoneCallback& done_callback) { | 218 void UrlFetcher::Start(const DoneCallback& done_callback) { |
| 217 core_->Start(done_callback); | 219 core_->Start(done_callback); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace remoting | 222 } // namespace remoting |
| OLD | NEW |