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_constants.h" | 9 #include "chrome/common/cloud_print/cloud_print_constants.h" |
10 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 10 #include "chrome/common/cloud_print/cloud_print_helpers.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 namespace cloud_print { | 21 namespace cloud_print { |
22 | 22 |
23 static CloudPrintURLFetcherFactory* g_factory = NULL; | 23 static CloudPrintURLFetcherFactory* g_factory = NULL; |
24 | 24 |
| 25 // virtual |
| 26 CloudPrintURLFetcherFactory::~CloudPrintURLFetcherFactory() {} |
| 27 |
25 // static | 28 // static |
26 CloudPrintURLFetcher* CloudPrintURLFetcher::Create() { | 29 CloudPrintURLFetcher* CloudPrintURLFetcher::Create() { |
27 CloudPrintURLFetcherFactory* factory = CloudPrintURLFetcher::factory(); | 30 CloudPrintURLFetcherFactory* factory = CloudPrintURLFetcher::factory(); |
28 return factory ? factory->CreateCloudPrintURLFetcher() : | 31 return factory ? factory->CreateCloudPrintURLFetcher() : |
29 new CloudPrintURLFetcher; | 32 new CloudPrintURLFetcher; |
30 } | 33 } |
31 | 34 |
32 // static | 35 // static |
33 CloudPrintURLFetcherFactory* CloudPrintURLFetcher::factory() { | 36 CloudPrintURLFetcherFactory* CloudPrintURLFetcher::factory() { |
34 return g_factory; | 37 return g_factory; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ServiceURLRequestContextGetter* getter = | 230 ServiceURLRequestContextGetter* getter = |
228 g_service_process->GetServiceURLRequestContextGetter(); | 231 g_service_process->GetServiceURLRequestContextGetter(); |
229 // Now set up the user agent for cloudprint. | 232 // Now set up the user agent for cloudprint. |
230 std::string user_agent = getter->user_agent(); | 233 std::string user_agent = getter->user_agent(); |
231 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); | 234 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); |
232 getter->set_user_agent(user_agent); | 235 getter->set_user_agent(user_agent); |
233 return getter; | 236 return getter; |
234 } | 237 } |
235 | 238 |
236 } // namespace cloud_print | 239 } // namespace cloud_print |
OLD | NEW |