OLD | NEW |
1 // Copyright (c) 2011 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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual void OnRequestGiveUp() { } | 74 virtual void OnRequestGiveUp() { } |
75 // Invoked when the request returns a 403 error (applicable only when | 75 // Invoked when the request returns a 403 error (applicable only when |
76 // HandleRawResponse returns CONTINUE_PROCESSING) | 76 // HandleRawResponse returns CONTINUE_PROCESSING) |
77 virtual void OnRequestAuthError() = 0; | 77 virtual void OnRequestAuthError() = 0; |
78 }; | 78 }; |
79 CloudPrintURLFetcher(); | 79 CloudPrintURLFetcher(); |
80 | 80 |
81 void StartGetRequest(const GURL& url, | 81 void StartGetRequest(const GURL& url, |
82 Delegate* delegate, | 82 Delegate* delegate, |
83 const std::string& auth_token, | 83 const std::string& auth_token, |
84 int max_retries); | 84 int max_retries, |
| 85 const std::string& additional_headers); |
85 void StartPostRequest(const GURL& url, | 86 void StartPostRequest(const GURL& url, |
86 Delegate* delegate, | 87 Delegate* delegate, |
87 const std::string& auth_token, | 88 const std::string& auth_token, |
88 int max_retries, | 89 int max_retries, |
89 const std::string& post_data_mime_type, | 90 const std::string& post_data_mime_type, |
90 const std::string& post_data); | 91 const std::string& post_data, |
| 92 const std::string& additional_headers); |
91 | 93 |
92 // URLFetcher::Delegate implementation. | 94 // URLFetcher::Delegate implementation. |
93 virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url, | 95 virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url, |
94 const net::URLRequestStatus& status, | 96 const net::URLRequestStatus& status, |
95 int response_code, | 97 int response_code, |
96 const ResponseCookies& cookies, | 98 const ResponseCookies& cookies, |
97 const std::string& data); | 99 const std::string& data); |
98 protected: | 100 protected: |
99 friend class base::RefCountedThreadSafe<CloudPrintURLFetcher>; | 101 friend class base::RefCountedThreadSafe<CloudPrintURLFetcher>; |
100 virtual ~CloudPrintURLFetcher(); | 102 virtual ~CloudPrintURLFetcher(); |
101 | 103 |
102 // Virtual for testing. | 104 // Virtual for testing. |
103 virtual URLRequestContextGetter* GetRequestContextGetter(); | 105 virtual URLRequestContextGetter* GetRequestContextGetter(); |
104 | 106 |
105 private: | 107 private: |
106 void StartRequestHelper(const GURL& url, | 108 void StartRequestHelper(const GURL& url, |
107 URLFetcher::RequestType request_type, | 109 URLFetcher::RequestType request_type, |
108 Delegate* delegate, | 110 Delegate* delegate, |
109 const std::string& auth_token, | 111 const std::string& auth_token, |
110 int max_retries, | 112 int max_retries, |
111 const std::string& post_data_mime_type, | 113 const std::string& post_data_mime_type, |
112 const std::string& post_data); | 114 const std::string& post_data, |
| 115 const std::string& additional_headers); |
113 | 116 |
114 scoped_ptr<URLFetcher> request_; | 117 scoped_ptr<URLFetcher> request_; |
115 Delegate* delegate_; | 118 Delegate* delegate_; |
116 int num_retries_; | 119 int num_retries_; |
117 }; | 120 }; |
118 | 121 |
119 typedef CloudPrintURLFetcher::Delegate CloudPrintURLFetcherDelegate; | 122 typedef CloudPrintURLFetcher::Delegate CloudPrintURLFetcherDelegate; |
120 | 123 |
121 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ | 124 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_URL_FETCHER_H_ |
OLD | NEW |