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 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class URLRequestStatus; | 23 class URLRequestStatus; |
24 } // namespace net | 24 } // namespace net |
25 | 25 |
26 namespace cloud_print { | 26 namespace cloud_print { |
27 | 27 |
28 // Factory for creating CloudPrintURLFetchers. | 28 // Factory for creating CloudPrintURLFetchers. |
29 class CloudPrintURLFetcher; | 29 class CloudPrintURLFetcher; |
30 class CloudPrintURLFetcherFactory { | 30 class CloudPrintURLFetcherFactory { |
31 public: | 31 public: |
32 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() = 0; | 32 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() = 0; |
| 33 virtual ~CloudPrintURLFetcherFactory(); |
33 }; | 34 }; |
34 | 35 |
35 // A wrapper around URLFetcher for CloudPrint. URLFetcher applies retry logic | 36 // A wrapper around URLFetcher for CloudPrint. URLFetcher applies retry logic |
36 // only on HTTP response codes >= 500. In the cloud print case, we want to | 37 // only on HTTP response codes >= 500. In the cloud print case, we want to |
37 // retry on all network errors. In addition, we want to treat non-JSON responses | 38 // retry on all network errors. In addition, we want to treat non-JSON responses |
38 // (for all CloudPrint APIs that expect JSON responses) as errors and they | 39 // (for all CloudPrint APIs that expect JSON responses) as errors and they |
39 // must also be retried. | 40 // must also be retried. |
40 class CloudPrintURLFetcher | 41 class CloudPrintURLFetcher |
41 : public base::RefCountedThreadSafe<CloudPrintURLFetcher>, | 42 : public base::RefCountedThreadSafe<CloudPrintURLFetcher>, |
42 public net::URLFetcherDelegate { | 43 public net::URLFetcherDelegate { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 std::string additional_headers_; | 146 std::string additional_headers_; |
146 std::string post_data_mime_type_; | 147 std::string post_data_mime_type_; |
147 std::string post_data_; | 148 std::string post_data_; |
148 }; | 149 }; |
149 | 150 |
150 typedef CloudPrintURLFetcher::Delegate CloudPrintURLFetcherDelegate; | 151 typedef CloudPrintURLFetcher::Delegate CloudPrintURLFetcherDelegate; |
151 | 152 |
152 } // namespace cloud_print | 153 } // namespace cloud_print |
153 | 154 |
154 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ | 155 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ |
OLD | NEW |