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

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

Issue 10065040: RefCounted types should not have public destructors, chrome/ remaining parts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 public CloudPrintURLFetcherDelegate, 65 public CloudPrintURLFetcherDelegate,
66 public JobStatusUpdaterDelegate, 66 public JobStatusUpdaterDelegate,
67 public cloud_print::PrinterWatcherDelegate, 67 public cloud_print::PrinterWatcherDelegate,
68 public cloud_print::JobSpoolerDelegate { 68 public cloud_print::JobSpoolerDelegate {
69 enum PrintJobError { 69 enum PrintJobError {
70 SUCCESS, 70 SUCCESS,
71 JOB_DOWNLOAD_FAILED, 71 JOB_DOWNLOAD_FAILED,
72 INVALID_JOB_DATA, 72 INVALID_JOB_DATA,
73 PRINT_FAILED, 73 PRINT_FAILED,
74 }; 74 };
75
75 struct JobDetails { 76 struct JobDetails {
76 JobDetails(); 77 JobDetails();
77 ~JobDetails(); 78 ~JobDetails();
78 void Clear(); 79 void Clear();
79 80
80 std::string job_id_; 81 std::string job_id_;
81 std::string job_title_; 82 std::string job_title_;
82 std::string print_ticket_; 83 std::string print_ticket_;
83 FilePath print_data_file_path_; 84 FilePath print_data_file_path_;
84 std::string print_data_mime_type_; 85 std::string print_data_mime_type_;
(...skipping 17 matching lines...) Expand all
102 std::string caps_hash; 103 std::string caps_hash;
103 std::string tags_hash; 104 std::string tags_hash;
104 }; 105 };
105 106
106 // Begin public interface 107 // Begin public interface
107 PrinterJobHandler(const printing::PrinterBasicInfo& printer_info, 108 PrinterJobHandler(const printing::PrinterBasicInfo& printer_info,
108 const PrinterInfoFromCloud& printer_info_from_server, 109 const PrinterInfoFromCloud& printer_info_from_server,
109 const GURL& cloud_print_server_url, 110 const GURL& cloud_print_server_url,
110 cloud_print::PrintSystem* print_system, 111 cloud_print::PrintSystem* print_system,
111 Delegate* delegate); 112 Delegate* delegate);
112 virtual ~PrinterJobHandler(); 113
113 bool Initialize(); 114 bool Initialize();
115
114 std::string GetPrinterName() const; 116 std::string GetPrinterName() const;
117
115 // Requests a job check. |reason| is the reason for fetching the job. Used 118 // Requests a job check. |reason| is the reason for fetching the job. Used
116 // for logging and diagnostc purposes. 119 // for logging and diagnostc purposes.
117 void CheckForJobs(const std::string& reason); 120 void CheckForJobs(const std::string& reason);
121
118 // Shutdown everything (the process is exiting). 122 // Shutdown everything (the process is exiting).
119 void Shutdown(); 123 void Shutdown();
124
120 base::TimeTicks last_job_fetch_time() const { return last_job_fetch_time_; } 125 base::TimeTicks last_job_fetch_time() const { return last_job_fetch_time_; }
121 // End public interface 126 // End public interface
122 127
123 // Begin Delegate implementations 128 // Begin Delegate implementations
124 129
125 // CloudPrintURLFetcher::Delegate implementation. 130 // CloudPrintURLFetcher::Delegate implementation.
126 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse( 131 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse(
127 const content::URLFetcher* source, 132 const content::URLFetcher* source,
128 const GURL& url, 133 const GURL& url,
129 const net::URLRequestStatus& status, 134 const net::URLRequestStatus& status,
(...skipping 24 matching lines...) Expand all
154 159
155 // cloud_print::JobSpoolerDelegate implementation. 160 // cloud_print::JobSpoolerDelegate implementation.
156 // Called on print_thread_. 161 // Called on print_thread_.
157 virtual void OnJobSpoolSucceeded( 162 virtual void OnJobSpoolSucceeded(
158 const cloud_print::PlatformJobId& job_id) OVERRIDE; 163 const cloud_print::PlatformJobId& job_id) OVERRIDE;
159 virtual void OnJobSpoolFailed() OVERRIDE; 164 virtual void OnJobSpoolFailed() OVERRIDE;
160 165
161 // End Delegate implementations 166 // End Delegate implementations
162 167
163 private: 168 private:
169 friend class base::RefCountedThreadSafe<PrinterJobHandler>;
170 virtual ~PrinterJobHandler();
171
164 // Prototype for a JSON data handler. 172 // Prototype for a JSON data handler.
165 typedef CloudPrintURLFetcher::ResponseAction 173 typedef CloudPrintURLFetcher::ResponseAction
166 (PrinterJobHandler::*JSONDataHandler)(const content::URLFetcher* source, 174 (PrinterJobHandler::*JSONDataHandler)(const content::URLFetcher* source,
167 const GURL& url, 175 const GURL& url,
168 base::DictionaryValue* json_data, 176 base::DictionaryValue* json_data,
169 bool succeeded); 177 bool succeeded);
170 // Prototype for a data handler. 178 // Prototype for a data handler.
171 typedef CloudPrintURLFetcher::ResponseAction 179 typedef CloudPrintURLFetcher::ResponseAction
172 (PrinterJobHandler::*DataHandler)(const content::URLFetcher* source, 180 (PrinterJobHandler::*DataHandler)(const content::URLFetcher* source,
173 const GURL& url, 181 const GURL& url,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler); 301 DISALLOW_COPY_AND_ASSIGN(PrinterJobHandler);
294 }; 302 };
295 303
296 // This typedef is to workaround the issue with certain versions of 304 // This typedef is to workaround the issue with certain versions of
297 // Visual Studio where it gets confused between multiple Delegate 305 // Visual Studio where it gets confused between multiple Delegate
298 // 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 -
299 // the workaround was not needed for my machine). 307 // the workaround was not needed for my machine).
300 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate; 308 typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate;
301 309
302 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ 310 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698