| OLD | NEW |
| 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_PRINT_SYSTEM_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_PRINT_SYSTEM_H_ |
| 6 #define CHROME_SERVICE_CLOUD_PRINT_PRINT_SYSTEM_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_PRINT_SYSTEM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // or Delegate::OnJobSpoolFailed methods are called) can fail. | 124 // or Delegate::OnJobSpoolFailed methods are called) can fail. |
| 125 virtual bool Spool(const std::string& print_ticket, | 125 virtual bool Spool(const std::string& print_ticket, |
| 126 const FilePath& print_data_file_path, | 126 const FilePath& print_data_file_path, |
| 127 const std::string& print_data_mime_type, | 127 const std::string& print_data_mime_type, |
| 128 const std::string& printer_name, | 128 const std::string& printer_name, |
| 129 const std::string& job_title, | 129 const std::string& job_title, |
| 130 const std::vector<std::string>& tags, | 130 const std::vector<std::string>& tags, |
| 131 JobSpooler::Delegate* delegate) = 0; | 131 JobSpooler::Delegate* delegate) = 0; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class PrintSystemResult { |
| 135 public: |
| 136 PrintSystemResult(bool succeeded, const std::string& message) |
| 137 : succeeded_(succeeded), message_(message) { } |
| 138 bool succeeded() const { return succeeded_; } |
| 139 std::string message() const { return message_; } |
| 140 |
| 141 private: |
| 142 bool succeeded_; |
| 143 std::string message_; |
| 144 |
| 145 PrintSystemResult() { } |
| 146 }; |
| 147 |
| 134 typedef Callback3< | 148 typedef Callback3< |
| 135 bool, | 149 bool, |
| 136 const std::string&, | 150 const std::string&, |
| 137 const printing::PrinterCapsAndDefaults&>::Type | 151 const printing::PrinterCapsAndDefaults&>::Type |
| 138 PrinterCapsAndDefaultsCallback; | 152 PrinterCapsAndDefaultsCallback; |
| 139 | 153 |
| 140 virtual ~PrintSystem(); | 154 virtual ~PrintSystem(); |
| 141 | 155 |
| 142 // Initialize print system. This need to be called before any other function | 156 // Initialize print system. This need to be called before any other function |
| 143 // of PrintSystem. | 157 // of PrintSystem. |
| 144 virtual void Init() = 0; | 158 virtual PrintSystemResult Init() = 0; |
| 145 | 159 |
| 146 // Enumerates the list of installed local and network printers. | 160 // Enumerates the list of installed local and network printers. |
| 147 virtual void EnumeratePrinters(printing::PrinterList* printer_list) = 0; | 161 virtual void EnumeratePrinters(printing::PrinterList* printer_list) = 0; |
| 148 | 162 |
| 149 // Gets the capabilities and defaults for a specific printer asynchronously. | 163 // Gets the capabilities and defaults for a specific printer asynchronously. |
| 150 virtual void GetPrinterCapsAndDefaults( | 164 virtual void GetPrinterCapsAndDefaults( |
| 151 const std::string& printer_name, | 165 const std::string& printer_name, |
| 152 PrinterCapsAndDefaultsCallback* callback) = 0; | 166 PrinterCapsAndDefaultsCallback* callback) = 0; |
| 153 | 167 |
| 154 // Returns true if printer_name points to a valid printer. | 168 // Returns true if printer_name points to a valid printer. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 185 // Visual Studio where it gets confused between multiple Delegate | 199 // Visual Studio where it gets confused between multiple Delegate |
| 186 // classes and gives a C2500 error. (I saw this error on the try bots - | 200 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 187 // the workaround was not needed for my machine). | 201 // the workaround was not needed for my machine). |
| 188 typedef PrintSystem::PrintServerWatcher::Delegate PrintServerWatcherDelegate; | 202 typedef PrintSystem::PrintServerWatcher::Delegate PrintServerWatcherDelegate; |
| 189 typedef PrintSystem::PrinterWatcher::Delegate PrinterWatcherDelegate; | 203 typedef PrintSystem::PrinterWatcher::Delegate PrinterWatcherDelegate; |
| 190 typedef PrintSystem::JobSpooler::Delegate JobSpoolerDelegate; | 204 typedef PrintSystem::JobSpooler::Delegate JobSpoolerDelegate; |
| 191 | 205 |
| 192 } // namespace cloud_print | 206 } // namespace cloud_print |
| 193 | 207 |
| 194 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINT_SYSTEM_H_ | 208 #endif // CHROME_SERVICE_CLOUD_PRINT_PRINT_SYSTEM_H_ |
| OLD | NEW |