OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/service/gaia/service_gaia_authenticator.h" | 5 #include "chrome/service/gaia/service_gaia_authenticator.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "chrome/service/net/service_url_request_context.h" | 8 #include "chrome/service/net/service_url_request_context.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 URLFetcher* request = new URLFetcher(post_url, URLFetcher::POST, this); | 65 URLFetcher* request = new URLFetcher(post_url, URLFetcher::POST, this); |
66 ServiceURLRequestContextGetter* context_getter = | 66 ServiceURLRequestContextGetter* context_getter = |
67 new ServiceURLRequestContextGetter(); | 67 new ServiceURLRequestContextGetter(); |
68 request->set_request_context(context_getter); | 68 request->set_request_context(context_getter); |
69 request->set_upload_data("application/x-www-form-urlencoded", post_body); | 69 request->set_upload_data("application/x-www-form-urlencoded", post_body); |
70 request->Start(); | 70 request->Start(); |
71 } | 71 } |
72 | 72 |
73 // URLFetcher::Delegate implementation | 73 // URLFetcher::Delegate implementation |
74 void ServiceGaiaAuthenticator::OnURLFetchComplete( | 74 void ServiceGaiaAuthenticator::OnURLFetchComplete( |
75 const URLFetcher *source, const GURL &url, const URLRequestStatus &status, | 75 const URLFetcher* source, |
76 int response_code, const ResponseCookies &cookies, | 76 const GURL& url, |
77 const std::string &data) { | 77 const net::URLRequestStatus& status, |
| 78 int response_code, |
| 79 const ResponseCookies& cookies, |
| 80 const std::string& data) { |
78 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 81 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
79 http_response_code_ = response_code; | 82 http_response_code_ = response_code; |
80 response_data_ = data; | 83 response_data_ = data; |
81 delete source; | 84 delete source; |
82 // Add an extra reference because we want http_post_completed_ to remain | 85 // Add an extra reference because we want http_post_completed_ to remain |
83 // valid until after Signal() returns. | 86 // valid until after Signal() returns. |
84 scoped_refptr<ServiceGaiaAuthenticator> keep_alive(this); | 87 scoped_refptr<ServiceGaiaAuthenticator> keep_alive(this); |
85 // Wake the blocked thread in Post. | 88 // Wake the blocked thread in Post. |
86 http_post_completed_.Signal(); | 89 http_post_completed_.Signal(); |
87 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! | 90 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! |
88 } | 91 } |
89 | 92 |
OLD | NEW |