Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/service/cloud_print/printer_job_handler.h

Issue 3945003: Move useful printing backend code from chrome/service/cloud_print to printing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resolve merge conflict Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/thread.h" 15 #include "base/thread.h"
16 #include "chrome/service/cloud_print/job_status_updater.h" 16 #include "chrome/service/cloud_print/job_status_updater.h"
17 #include "chrome/service/cloud_print/print_system.h"
18 #include "chrome/common/net/url_fetcher.h" 17 #include "chrome/common/net/url_fetcher.h"
19 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
20 #include "net/url_request/url_request_status.h" 19 #include "net/url_request/url_request_status.h"
20 #include "printing/backend/print_backend.h"
21 21
22 // A class that handles cloud print jobs for a particular printer. This class 22 // A class that handles cloud print jobs for a particular printer. This class
23 // imlements a state machine that transitions from Start to various states. The 23 // imlements a state machine that transitions from Start to various states. The
24 // various states are shown in the below diagram. 24 // various states are shown in the below diagram.
25 // the status on the server. 25 // the status on the server.
26 26
27 // Start --> No pending tasks --> Done 27 // Start --> No pending tasks --> Done
28 // | 28 // |
29 // | 29 // |
30 // | Have Pending tasks 30 // | Have Pending tasks
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 virtual ~Delegate() {} 97 virtual ~Delegate() {}
98 }; 98 };
99 99
100 struct PrinterInfoFromCloud { 100 struct PrinterInfoFromCloud {
101 std::string printer_id; 101 std::string printer_id;
102 std::string caps_hash; 102 std::string caps_hash;
103 std::string tags_hash; 103 std::string tags_hash;
104 }; 104 };
105 105
106 // Begin public interface 106 // Begin public interface
107 PrinterJobHandler(const cloud_print::PrinterBasicInfo& printer_info, 107 PrinterJobHandler(const printing::PrinterBasicInfo& printer_info,
108 const PrinterInfoFromCloud& printer_info_from_server, 108 const PrinterInfoFromCloud& printer_info_from_server,
109 const std::string& auth_token, 109 const std::string& auth_token,
110 const GURL& cloud_print_server_url, 110 const GURL& cloud_print_server_url,
111 cloud_print::PrintSystem* print_system, 111 cloud_print::PrintSystem* print_system,
112 Delegate* delegate); 112 Delegate* delegate);
113 ~PrinterJobHandler(); 113 ~PrinterJobHandler();
114 bool Initialize(); 114 bool Initialize();
115 // Notifies the JobHandler that a job is available 115 // Notifies the JobHandler that a job is available
116 void NotifyJobAvailable(); 116 void NotifyJobAvailable();
117 // Shutdown everything (the process is exiting). 117 // Shutdown everything (the process is exiting).
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool UpdatePrinterInfo(); 225 bool UpdatePrinterInfo();
226 bool HavePendingTasks(); 226 bool HavePendingTasks();
227 void FailedFetchingJobData(); 227 void FailedFetchingJobData();
228 228
229 // Called on print_thread_. 229 // Called on print_thread_.
230 void DoPrint(const JobDetails& job_details, 230 void DoPrint(const JobDetails& job_details,
231 const std::string& printer_name); 231 const std::string& printer_name);
232 232
233 scoped_ptr<URLFetcher> request_; 233 scoped_ptr<URLFetcher> request_;
234 scoped_refptr<cloud_print::PrintSystem> print_system_; 234 scoped_refptr<cloud_print::PrintSystem> print_system_;
235 cloud_print::PrinterBasicInfo printer_info_; 235 printing::PrinterBasicInfo printer_info_;
236 PrinterInfoFromCloud printer_info_cloud_; 236 PrinterInfoFromCloud printer_info_cloud_;
237 std::string auth_token_; 237 std::string auth_token_;
238 GURL cloud_print_server_url_; 238 GURL cloud_print_server_url_;
239 std::string print_data_url_; 239 std::string print_data_url_;
240 JobDetails job_details_; 240 JobDetails job_details_;
241 Delegate* delegate_; 241 Delegate* delegate_;
242 // Once the job has been spooled to the local spooler, this specifies the 242 // Once the job has been spooled to the local spooler, this specifies the
243 // job id of the job on the local spooler. 243 // job id of the job on the local spooler.
244 cloud_print::PlatformJobId local_job_id_; 244 cloud_print::PlatformJobId local_job_id_;
245 ResponseHandler next_response_handler_; 245 ResponseHandler next_response_handler_;
(...skipping 27 matching lines...) Expand all
273 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler); 273 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler);
274 }; 274 };
275 275
276 // This typedef is to workaround the issue with certain versions of 276 // This typedef is to workaround the issue with certain versions of
277 // Visual Studio where it gets confused between multiple Delegate 277 // Visual Studio where it gets confused between multiple Delegate
278 // classes and gives a C2500 error. (I saw this error on the try bots - 278 // classes and gives a C2500 error. (I saw this error on the try bots -
279 // the workaround was not needed for my machine). 279 // the workaround was not needed for my machine).
280 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate; 280 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate;
281 281
282 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ 282 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_
283
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_win.cc ('k') | chrome/service/cloud_print/printer_job_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698