OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/glue/http_bridge.h" | 5 #include "chrome/browser/sync/glue/http_bridge.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
11 #include "net/base/cookie_monster.h" | 11 #include "net/base/cookie_monster.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const std::string HttpBridge::GetResponseHeaderValue( | 212 const std::string HttpBridge::GetResponseHeaderValue( |
213 const std::string& name) const { | 213 const std::string& name) const { |
214 | 214 |
215 DCHECK_EQ(MessageLoop::current(), created_on_loop_); | 215 DCHECK_EQ(MessageLoop::current(), created_on_loop_); |
216 DCHECK(request_completed_); | 216 DCHECK(request_completed_); |
217 std::string value; | 217 std::string value; |
218 response_headers_->EnumerateHeader(NULL, name, &value); | 218 response_headers_->EnumerateHeader(NULL, name, &value); |
219 return value; | 219 return value; |
220 } | 220 } |
221 | 221 |
222 void HttpBridge::OnURLFetchComplete(const URLFetcher *source, const GURL &url, | 222 void HttpBridge::OnURLFetchComplete(const URLFetcher *source, |
223 const URLRequestStatus &status, | 223 const GURL &url, |
| 224 const net::URLRequestStatus &status, |
224 int response_code, | 225 int response_code, |
225 const ResponseCookies &cookies, | 226 const ResponseCookies &cookies, |
226 const std::string &data) { | 227 const std::string &data) { |
227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
228 | 229 |
229 request_completed_ = true; | 230 request_completed_ = true; |
230 request_succeeded_ = (URLRequestStatus::SUCCESS == status.status()); | 231 request_succeeded_ = (net::URLRequestStatus::SUCCESS == status.status()); |
231 http_response_code_ = response_code; | 232 http_response_code_ = response_code; |
232 os_error_code_ = status.os_error(); | 233 os_error_code_ = status.os_error(); |
233 | 234 |
234 response_content_ = data; | 235 response_content_ = data; |
235 response_headers_ = source->response_headers(); | 236 response_headers_ = source->response_headers(); |
236 | 237 |
237 // End of the line for url_poster_. It lives only on the IO loop. | 238 // End of the line for url_poster_. It lives only on the IO loop. |
238 // We defer deletion because we're inside a callback from a component of the | 239 // We defer deletion because we're inside a callback from a component of the |
239 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. | 240 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. |
240 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_); | 241 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_); |
241 url_poster_ = NULL; | 242 url_poster_ = NULL; |
242 | 243 |
243 // Wake the blocked syncer thread in MakeSynchronousPost. | 244 // Wake the blocked syncer thread in MakeSynchronousPost. |
244 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! | 245 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! |
245 http_post_completed_.Signal(); | 246 http_post_completed_.Signal(); |
246 } | 247 } |
247 | 248 |
248 } // namespace browser_sync | 249 } // namespace browser_sync |
OLD | NEW |