OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_EXTENSION_PRINTER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 namespace device { | 33 namespace device { |
34 class UsbDevice; | 34 class UsbDevice; |
35 } | 35 } |
36 | 36 |
37 namespace gfx { | 37 namespace gfx { |
38 class Size; | 38 class Size; |
39 } | 39 } |
40 | 40 |
41 namespace local_discovery { | 41 namespace printing { |
42 class PWGRasterConverter; | 42 class PWGRasterConverter; |
43 } | 43 } |
44 | 44 |
45 // Implementation of PrinterHandler interface backed by printerProvider | 45 // Implementation of PrinterHandler interface backed by printerProvider |
46 // extension API. | 46 // extension API. |
47 class ExtensionPrinterHandler : public PrinterHandler { | 47 class ExtensionPrinterHandler : public PrinterHandler { |
48 public: | 48 public: |
49 using PrintJobCallback = | 49 using PrintJobCallback = |
50 base::Callback<void(scoped_ptr<extensions::PrinterProviderPrintJob>)>; | 50 base::Callback<void(scoped_ptr<extensions::PrinterProviderPrintJob>)>; |
51 | 51 |
(...skipping 18 matching lines...) Expand all Loading... |
70 const gfx::Size& page_size, | 70 const gfx::Size& page_size, |
71 const scoped_refptr<base::RefCountedMemory>& print_data, | 71 const scoped_refptr<base::RefCountedMemory>& print_data, |
72 const PrinterHandler::PrintCallback& callback) override; | 72 const PrinterHandler::PrintCallback& callback) override; |
73 void StartGrantPrinterAccess( | 73 void StartGrantPrinterAccess( |
74 const std::string& printer_id, | 74 const std::string& printer_id, |
75 const PrinterHandler::GetPrinterInfoCallback& callback) override; | 75 const PrinterHandler::GetPrinterInfoCallback& callback) override; |
76 | 76 |
77 private: | 77 private: |
78 friend class ExtensionPrinterHandlerTest; | 78 friend class ExtensionPrinterHandlerTest; |
79 | 79 |
80 void SetPwgRasterConverterForTesting( | 80 void SetPWGRasterConverterForTesting( |
81 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter); | 81 scoped_ptr<printing::PWGRasterConverter> pwg_raster_converter); |
82 | 82 |
83 // Converts |data| to PWG raster format (from PDF) for a printer described | 83 // Converts |data| to PWG raster format (from PDF) for a printer described |
84 // by |printer_description|. | 84 // by |printer_description|. |
85 // |callback| is called with the converted data. | 85 // |callback| is called with the converted data. |
86 void ConvertToPWGRaster( | 86 void ConvertToPWGRaster( |
87 const scoped_refptr<base::RefCountedMemory>& data, | 87 const scoped_refptr<base::RefCountedMemory>& data, |
88 const cloud_devices::CloudDeviceDescription& printer_description, | 88 const cloud_devices::CloudDeviceDescription& printer_description, |
89 const cloud_devices::CloudDeviceDescription& ticket, | 89 const cloud_devices::CloudDeviceDescription& ticket, |
90 const gfx::Size& page_size, | 90 const gfx::Size& page_size, |
91 scoped_ptr<extensions::PrinterProviderPrintJob> job, | 91 scoped_ptr<extensions::PrinterProviderPrintJob> job, |
(...skipping 20 matching lines...) Expand all Loading... |
112 const std::string& status); | 112 const std::string& status); |
113 void WrapGetPrinterInfoCallback(const GetPrinterInfoCallback& callback, | 113 void WrapGetPrinterInfoCallback(const GetPrinterInfoCallback& callback, |
114 const base::DictionaryValue& printer_info); | 114 const base::DictionaryValue& printer_info); |
115 | 115 |
116 void OnUsbDevicesEnumerated( | 116 void OnUsbDevicesEnumerated( |
117 const PrinterHandler::GetPrintersCallback& callback, | 117 const PrinterHandler::GetPrintersCallback& callback, |
118 const std::vector<scoped_refptr<device::UsbDevice>>& devices); | 118 const std::vector<scoped_refptr<device::UsbDevice>>& devices); |
119 | 119 |
120 content::BrowserContext* browser_context_; | 120 content::BrowserContext* browser_context_; |
121 | 121 |
122 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter_; | 122 scoped_ptr<printing::PWGRasterConverter> pwg_raster_converter_; |
123 int pending_enumeration_count_ = 0; | 123 int pending_enumeration_count_ = 0; |
124 | 124 |
125 scoped_refptr<base::TaskRunner> slow_task_runner_; | 125 scoped_refptr<base::TaskRunner> slow_task_runner_; |
126 | 126 |
127 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; | 127 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); | 129 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); |
130 }; | 130 }; |
131 | 131 |
132 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ | 132 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ |
OLD | NEW |