| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "printing/backend/print_backend.h" | 13 #include "printing/backend/print_backend.h" |
| 14 | 14 |
| 15 #if defined(OS_CHROMEOS) |
| 15 class Profile; | 16 class Profile; |
| 17 #endif |
| 16 | 18 |
| 17 namespace printing { | 19 namespace printing { |
| 18 | 20 |
| 19 using EnumeratePrintersCallback = base::Callback<void(const PrinterList&)>; | 21 using EnumeratePrintersCallback = base::Callback<void(const PrinterList&)>; |
| 20 | 22 |
| 21 using PrinterSetupCallback = | 23 using PrinterSetupCallback = |
| 22 base::Callback<void(std::unique_ptr<base::DictionaryValue>)>; | 24 base::Callback<void(std::unique_ptr<base::DictionaryValue>)>; |
| 23 | 25 |
| 24 // Returns the name of the default printer. | 26 class PrinterBackendProxy { |
| 25 std::string GetDefaultPrinterOnBlockingPoolThread(); | 27 public: |
| 28 #if defined(OS_CHROMEOS) |
| 29 static std::unique_ptr<PrinterBackendProxy> Create(Profile* profile); |
| 30 #else |
| 31 static std::unique_ptr<PrinterBackendProxy> Create(); |
| 32 #endif |
| 26 | 33 |
| 27 // Retrieves printers for display in the print dialog and calls |cb| with the | 34 // Returns the name of the default printer. |
| 28 // list. This method expects to be called on the UI thread. | 35 virtual std::string GetDefaultPrinterOnBlockingPoolThread() = 0; |
| 29 void EnumeratePrinters(Profile* profile, const EnumeratePrintersCallback& cb); | |
| 30 | 36 |
| 31 // Verifies printer setup if needed then retrieves printer capabilities for | 37 // Retrieves printers for display in the print dialog and calls |cb| with the |
| 32 // |printer_name|. |cb| is called with the capabilities dictionary or nullptr | 38 // list. This method expects to be called on the UI thread. |
| 33 // if one of the steps failed. | 39 virtual void EnumeratePrinters(const EnumeratePrintersCallback& cb) = 0; |
| 34 void ConfigurePrinterAndFetchCapabilities(Profile* profile, | 40 |
| 35 const std::string& printer_name, | 41 // Verifies printer setup if needed then retrieves printer capabilities for |
| 36 const PrinterSetupCallback& cb); | 42 // |printer_name|. |cb| is called with the capabilities dictionary or nullptr |
| 43 // if one of the steps failed. |
| 44 virtual void ConfigurePrinterAndFetchCapabilities( |
| 45 const std::string& printer_name, |
| 46 const PrinterSetupCallback& cb) = 0; |
| 47 }; |
| 37 | 48 |
| 38 } // namespace printing | 49 } // namespace printing |
| 39 | 50 |
| 40 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ | 51 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ |
| OLD | NEW |