| 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_PRINTER_JOB_HANDLER_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ |
| 6 #define CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 int response_code, | 133 int response_code, |
| 134 const net::ResponseCookies& cookies, | 134 const net::ResponseCookies& cookies, |
| 135 const std::string& data); | 135 const std::string& data); |
| 136 virtual CloudPrintURLFetcher::ResponseAction HandleRawData( | 136 virtual CloudPrintURLFetcher::ResponseAction HandleRawData( |
| 137 const URLFetcher* source, | 137 const URLFetcher* source, |
| 138 const GURL& url, | 138 const GURL& url, |
| 139 const std::string& data); | 139 const std::string& data); |
| 140 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( | 140 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( |
| 141 const URLFetcher* source, | 141 const URLFetcher* source, |
| 142 const GURL& url, | 142 const GURL& url, |
| 143 DictionaryValue* json_data, | 143 base::DictionaryValue* json_data, |
| 144 bool succeeded); | 144 bool succeeded); |
| 145 virtual void OnRequestGiveUp(); | 145 virtual void OnRequestGiveUp(); |
| 146 virtual void OnRequestAuthError(); | 146 virtual void OnRequestAuthError(); |
| 147 | 147 |
| 148 // JobStatusUpdater::Delegate implementation | 148 // JobStatusUpdater::Delegate implementation |
| 149 virtual bool OnJobCompleted(JobStatusUpdater* updater); | 149 virtual bool OnJobCompleted(JobStatusUpdater* updater); |
| 150 virtual void OnAuthError(); | 150 virtual void OnAuthError(); |
| 151 | 151 |
| 152 // cloud_print::PrinterWatcherDelegate implementation | 152 // cloud_print::PrinterWatcherDelegate implementation |
| 153 virtual void OnPrinterDeleted(); | 153 virtual void OnPrinterDeleted(); |
| 154 virtual void OnPrinterChanged(); | 154 virtual void OnPrinterChanged(); |
| 155 virtual void OnJobChanged(); | 155 virtual void OnJobChanged(); |
| 156 | 156 |
| 157 // cloud_print::JobSpoolerDelegate implementation. | 157 // cloud_print::JobSpoolerDelegate implementation. |
| 158 // Called on print_thread_. | 158 // Called on print_thread_. |
| 159 virtual void OnJobSpoolSucceeded(const cloud_print::PlatformJobId& job_id); | 159 virtual void OnJobSpoolSucceeded(const cloud_print::PlatformJobId& job_id); |
| 160 virtual void OnJobSpoolFailed(); | 160 virtual void OnJobSpoolFailed(); |
| 161 | 161 |
| 162 // End Delegate implementations | 162 // End Delegate implementations |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 // Prototype for a JSON data handler. | 165 // Prototype for a JSON data handler. |
| 166 typedef CloudPrintURLFetcher::ResponseAction | 166 typedef CloudPrintURLFetcher::ResponseAction |
| 167 (PrinterJobHandler::*JSONDataHandler)(const URLFetcher* source, | 167 (PrinterJobHandler::*JSONDataHandler)(const URLFetcher* source, |
| 168 const GURL& url, | 168 const GURL& url, |
| 169 DictionaryValue* json_data, | 169 base::DictionaryValue* json_data, |
| 170 bool succeeded); | 170 bool succeeded); |
| 171 // Prototype for a data handler. | 171 // Prototype for a data handler. |
| 172 typedef CloudPrintURLFetcher::ResponseAction | 172 typedef CloudPrintURLFetcher::ResponseAction |
| 173 (PrinterJobHandler::*DataHandler)(const URLFetcher* source, | 173 (PrinterJobHandler::*DataHandler)(const URLFetcher* source, |
| 174 const GURL& url, | 174 const GURL& url, |
| 175 const std::string& data); | 175 const std::string& data); |
| 176 // Begin request handlers for each state in the state machine | 176 // Begin request handlers for each state in the state machine |
| 177 CloudPrintURLFetcher::ResponseAction HandlePrinterUpdateResponse( | 177 CloudPrintURLFetcher::ResponseAction HandlePrinterUpdateResponse( |
| 178 const URLFetcher* source, | 178 const URLFetcher* source, |
| 179 const GURL& url, | 179 const GURL& url, |
| 180 DictionaryValue* json_data, | 180 base::DictionaryValue* json_data, |
| 181 bool succeeded); | 181 bool succeeded); |
| 182 | 182 |
| 183 CloudPrintURLFetcher::ResponseAction HandlePrinterDeleteResponse( | 183 CloudPrintURLFetcher::ResponseAction HandlePrinterDeleteResponse( |
| 184 const URLFetcher* source, | 184 const URLFetcher* source, |
| 185 const GURL& url, | 185 const GURL& url, |
| 186 DictionaryValue* json_data, | 186 base::DictionaryValue* json_data, |
| 187 bool succeeded); | 187 bool succeeded); |
| 188 | 188 |
| 189 CloudPrintURLFetcher::ResponseAction HandleJobMetadataResponse( | 189 CloudPrintURLFetcher::ResponseAction HandleJobMetadataResponse( |
| 190 const URLFetcher* source, | 190 const URLFetcher* source, |
| 191 const GURL& url, | 191 const GURL& url, |
| 192 DictionaryValue* json_data, | 192 base::DictionaryValue* json_data, |
| 193 bool succeeded); | 193 bool succeeded); |
| 194 | 194 |
| 195 CloudPrintURLFetcher::ResponseAction HandlePrintTicketResponse( | 195 CloudPrintURLFetcher::ResponseAction HandlePrintTicketResponse( |
| 196 const URLFetcher* source, | 196 const URLFetcher* source, |
| 197 const GURL& url, | 197 const GURL& url, |
| 198 const std::string& data); | 198 const std::string& data); |
| 199 | 199 |
| 200 CloudPrintURLFetcher::ResponseAction HandlePrintDataResponse( | 200 CloudPrintURLFetcher::ResponseAction HandlePrintDataResponse( |
| 201 const URLFetcher* source, | 201 const URLFetcher* source, |
| 202 const GURL& url, | 202 const GURL& url, |
| 203 const std::string& data); | 203 const std::string& data); |
| 204 | 204 |
| 205 CloudPrintURLFetcher::ResponseAction HandleSuccessStatusUpdateResponse( | 205 CloudPrintURLFetcher::ResponseAction HandleSuccessStatusUpdateResponse( |
| 206 const URLFetcher* source, | 206 const URLFetcher* source, |
| 207 const GURL& url, | 207 const GURL& url, |
| 208 DictionaryValue* json_data, | 208 base::DictionaryValue* json_data, |
| 209 bool succeeded); | 209 bool succeeded); |
| 210 | 210 |
| 211 CloudPrintURLFetcher::ResponseAction HandleFailureStatusUpdateResponse( | 211 CloudPrintURLFetcher::ResponseAction HandleFailureStatusUpdateResponse( |
| 212 const URLFetcher* source, | 212 const URLFetcher* source, |
| 213 const GURL& url, | 213 const GURL& url, |
| 214 DictionaryValue* json_data, | 214 base::DictionaryValue* json_data, |
| 215 bool succeeded); | 215 bool succeeded); |
| 216 // End request handlers for each state in the state machine | 216 // End request handlers for each state in the state machine |
| 217 | 217 |
| 218 // Start the state machine. Based on the flags set this could mean updating | 218 // Start the state machine. Based on the flags set this could mean updating |
| 219 // printer information, deleting the printer from the server or looking for | 219 // printer information, deleting the printer from the server or looking for |
| 220 // new print jobs | 220 // new print jobs |
| 221 void Start(); | 221 void Start(); |
| 222 | 222 |
| 223 // End the state machine. If there are pending tasks, we will post a Start | 223 // End the state machine. If there are pending tasks, we will post a Start |
| 224 // again. | 224 // again. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler); | 301 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler); |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 // This typedef is to workaround the issue with certain versions of | 304 // This typedef is to workaround the issue with certain versions of |
| 305 // Visual Studio where it gets confused between multiple Delegate | 305 // Visual Studio where it gets confused between multiple Delegate |
| 306 // classes and gives a C2500 error. (I saw this error on the try bots - | 306 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 307 // the workaround was not needed for my machine). | 307 // the workaround was not needed for my machine). |
| 308 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate; | 308 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate; |
| 309 | 309 |
| 310 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ | 310 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ |
| OLD | NEW |