| 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 | 
|  | 21 using DefaultPrinterCallback = | 
|  | 22     base::Callback<void(const std::string& printer_name)>; | 
|  | 23 | 
| 19 using EnumeratePrintersCallback = base::Callback<void(const PrinterList&)>; | 24 using EnumeratePrintersCallback = base::Callback<void(const PrinterList&)>; | 
| 20 | 25 | 
| 21 using PrinterSetupCallback = | 26 using PrinterSetupCallback = | 
| 22     base::Callback<void(std::unique_ptr<base::DictionaryValue>)>; | 27     base::Callback<void(std::unique_ptr<base::DictionaryValue> settings)>; | 
| 23 | 28 | 
| 24 // Returns the name of the default printer. | 29 class PrinterBackendProxy { | 
| 25 std::string GetDefaultPrinterOnBlockingPoolThread(); | 30  public: | 
|  | 31 #if defined(OS_CHROMEOS) | 
|  | 32   static std::unique_ptr<PrinterBackendProxy> Create(Profile* profile); | 
|  | 33 #else | 
|  | 34   static std::unique_ptr<PrinterBackendProxy> Create(); | 
|  | 35 #endif | 
| 26 | 36 | 
| 27 // Retrieves printers for display in the print dialog and calls |cb| with the | 37   virtual ~PrinterBackendProxy() = default; | 
| 28 // list.  This method expects to be called on the UI thread. |  | 
| 29 void EnumeratePrinters(Profile* profile, const EnumeratePrintersCallback& cb); |  | 
| 30 | 38 | 
| 31 // Verifies printer setup if needed then retrieves printer capabilities for | 39   // Returns the name of the default printer through |cb|.  This method expects | 
| 32 // |printer_name|.  |cb| is called with the capabilities dictionary or nullptr | 40   // to be called on the UI thread. | 
| 33 // if one of the steps failed. | 41   virtual void GetDefaultPrinter(const DefaultPrinterCallback& cb) = 0; | 
| 34 void ConfigurePrinterAndFetchCapabilities(Profile* profile, | 42 | 
| 35                                           const std::string& printer_name, | 43   // Retrieves printers for display in the print dialog and calls |cb| with the | 
| 36                                           const PrinterSetupCallback& cb); | 44   // list.  This method expects to be called on the UI thread. | 
|  | 45   virtual void EnumeratePrinters(const EnumeratePrintersCallback& cb) = 0; | 
|  | 46 | 
|  | 47   // Verifies printer setup if needed then retrieves printer capabilities for | 
|  | 48   // |printer_name|.  |cb| is called with the capabilities dictionary or nullptr | 
|  | 49   // if one of the steps failed. | 
|  | 50   virtual void ConfigurePrinterAndFetchCapabilities( | 
|  | 51       const std::string& printer_name, | 
|  | 52       const PrinterSetupCallback& cb) = 0; | 
|  | 53 }; | 
| 37 | 54 | 
| 38 }  // namespace printing | 55 }  // namespace printing | 
| 39 | 56 | 
| 40 #endif  // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ | 57 #endif  // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_BACKEND_PROXY_H_ | 
| OLD | NEW | 
|---|