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 "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/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 9 #include "chrome/common/cloud_print/cloud_print_helpers.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" |
12 #include "chrome/service/cloud_print/cloud_print_token_store.h" | 12 #include "chrome/service/cloud_print/cloud_print_token_store.h" |
13 #include "chrome/service/net/service_url_request_context.h" | 13 #include "chrome/service/net/service_url_request_context.h" |
14 #include "chrome/service/service_process.h" | 14 #include "chrome/service/service_process.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "net/base/load_flags.h" | 16 #include "net/base/load_flags.h" |
17 #include "net/http/http_status_code.h" | 17 #include "net/http/http_status_code.h" |
18 #include "net/url_request/url_fetcher.h" | 18 #include "net/url_request/url_fetcher.h" |
19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
20 | 20 |
| 21 |
| 22 CloudPrintURLFetcher::ResponseAction |
| 23 CloudPrintURLFetcher::Delegate::HandleRawResponse( |
| 24 const net::URLFetcher* source, |
| 25 const GURL& url, |
| 26 const net::URLRequestStatus& status, |
| 27 int response_code, |
| 28 const net::ResponseCookies& cookies, |
| 29 const std::string& data) { |
| 30 return CONTINUE_PROCESSING; |
| 31 } |
| 32 |
| 33 CloudPrintURLFetcher::ResponseAction |
| 34 CloudPrintURLFetcher::Delegate::HandleRawData( |
| 35 const net::URLFetcher* source, |
| 36 const GURL& url, |
| 37 const std::string& data) { |
| 38 return CONTINUE_PROCESSING; |
| 39 } |
| 40 |
| 41 CloudPrintURLFetcher::ResponseAction |
| 42 CloudPrintURLFetcher::Delegate::HandleJSONData( |
| 43 const net::URLFetcher* source, |
| 44 const GURL& url, |
| 45 base::DictionaryValue* json_data, |
| 46 bool succeeded) { |
| 47 return CONTINUE_PROCESSING; |
| 48 } |
| 49 |
21 CloudPrintURLFetcher::CloudPrintURLFetcher() | 50 CloudPrintURLFetcher::CloudPrintURLFetcher() |
22 : delegate_(NULL), | 51 : delegate_(NULL), |
23 num_retries_(0) { | 52 num_retries_(0) { |
24 } | 53 } |
25 | 54 |
26 bool CloudPrintURLFetcher::IsSameRequest(const net::URLFetcher* source) { | 55 bool CloudPrintURLFetcher::IsSameRequest(const net::URLFetcher* source) { |
27 return (request_.get() == source); | 56 return (request_.get() == source); |
28 } | 57 } |
29 | 58 |
30 void CloudPrintURLFetcher::StartGetRequest( | 59 void CloudPrintURLFetcher::StartGetRequest( |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 205 |
177 net::URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() { | 206 net::URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() { |
178 ServiceURLRequestContextGetter* getter = | 207 ServiceURLRequestContextGetter* getter = |
179 g_service_process->GetServiceURLRequestContextGetter(); | 208 g_service_process->GetServiceURLRequestContextGetter(); |
180 // Now set up the user agent for cloudprint. | 209 // Now set up the user agent for cloudprint. |
181 std::string user_agent = getter->user_agent(); | 210 std::string user_agent = getter->user_agent(); |
182 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); | 211 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); |
183 getter->set_user_agent(user_agent); | 212 getter->set_user_agent(user_agent); |
184 return getter; | 213 return getter; |
185 } | 214 } |
OLD | NEW |