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/service/cloud_print/cloud_print_url_fetcher.h" | 5 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/net/http_return.h" | 9 #include "chrome/common/net/http_return.h" |
10 #include "chrome/service/cloud_print/cloud_print_consts.h" | 10 #include "chrome/service/cloud_print/cloud_print_consts.h" |
11 #include "chrome/service/cloud_print/cloud_print_helpers.h" | 11 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
(...skipping 22 matching lines...) Expand all Loading... |
34 const std::string& post_data_mime_type, | 34 const std::string& post_data_mime_type, |
35 const std::string& post_data) { | 35 const std::string& post_data) { |
36 StartRequestHelper(url, URLFetcher::POST, delegate, auth_token, max_retries, | 36 StartRequestHelper(url, URLFetcher::POST, delegate, auth_token, max_retries, |
37 post_data_mime_type, post_data); | 37 post_data_mime_type, post_data); |
38 } | 38 } |
39 | 39 |
40 // URLFetcher::Delegate implementation. | 40 // URLFetcher::Delegate implementation. |
41 void CloudPrintURLFetcher::OnURLFetchComplete( | 41 void CloudPrintURLFetcher::OnURLFetchComplete( |
42 const URLFetcher* source, | 42 const URLFetcher* source, |
43 const GURL& url, | 43 const GURL& url, |
44 const URLRequestStatus& status, | 44 const net::URLRequestStatus& status, |
45 int response_code, | 45 int response_code, |
46 const ResponseCookies& cookies, | 46 const ResponseCookies& cookies, |
47 const std::string& data) { | 47 const std::string& data) { |
48 VLOG(1) << "CP_PROXY: OnURLFetchComplete, url: " << url | 48 VLOG(1) << "CP_PROXY: OnURLFetchComplete, url: " << url |
49 << ", response code: " << response_code; | 49 << ", response code: " << response_code; |
50 // Make sure we stay alive through the body of this function. | 50 // Make sure we stay alive through the body of this function. |
51 scoped_refptr<CloudPrintURLFetcher> keep_alive(this); | 51 scoped_refptr<CloudPrintURLFetcher> keep_alive(this); |
52 ResponseAction action = delegate_->HandleRawResponse(source, | 52 ResponseAction action = delegate_->HandleRawResponse(source, |
53 url, | 53 url, |
54 status, | 54 status, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() { | 138 URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() { |
139 ServiceURLRequestContextGetter* getter = | 139 ServiceURLRequestContextGetter* getter = |
140 new ServiceURLRequestContextGetter(); | 140 new ServiceURLRequestContextGetter(); |
141 // Now set up the user agent for cloudprint. | 141 // Now set up the user agent for cloudprint. |
142 std::string user_agent = getter->user_agent(); | 142 std::string user_agent = getter->user_agent(); |
143 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); | 143 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); |
144 getter->set_user_agent(user_agent); | 144 getter->set_user_agent(user_agent); |
145 return getter; | 145 return getter; |
146 } | 146 } |
147 | 147 |
OLD | NEW |