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 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // by |printer_description|. | 66 // by |printer_description|. |
67 // |callback| is called with the converted data. | 67 // |callback| is called with the converted data. |
68 void ConvertToPWGRaster( | 68 void ConvertToPWGRaster( |
69 const scoped_refptr<base::RefCountedMemory>& data, | 69 const scoped_refptr<base::RefCountedMemory>& data, |
70 const cloud_devices::CloudDeviceDescription& printer_description, | 70 const cloud_devices::CloudDeviceDescription& printer_description, |
71 const std::string& ticket, | 71 const std::string& ticket, |
72 const gfx::Size& page_size, | 72 const gfx::Size& page_size, |
73 const RefCountedMemoryCallback& callback); | 73 const RefCountedMemoryCallback& callback); |
74 | 74 |
75 // Sets print job document data and dispatches it using printerProvider API. | 75 // Sets print job document data and dispatches it using printerProvider API. |
76 // TODO(tbarzic): Move PrinterProvider::PrintJob to it's own file so it can | |
77 // be forward-declared. | |
78 void DispatchPrintJob( | 76 void DispatchPrintJob( |
79 const PrinterHandler::PrintCallback& callback, | 77 const PrinterHandler::PrintCallback& callback, |
80 scoped_ptr<extensions::PrinterProviderAPI::PrintJob> print_job, | 78 scoped_ptr<extensions::PrinterProviderPrintJob> print_job, |
81 const scoped_refptr<base::RefCountedMemory>& data); | 79 const scoped_refptr<base::RefCountedMemory>& data); |
82 | 80 |
83 // Methods used as wrappers to callbacks for extensions::PrinterProviderAPI | 81 // Methods used as wrappers to callbacks for extensions::PrinterProviderAPI |
84 // methods, primarily so the callbacks can be bound to this class' weak ptr. | 82 // methods, primarily so the callbacks can be bound to this class' weak ptr. |
85 // They just propagate results to callbacks passed to them. | 83 // They just propagate results to callbacks passed to them. |
86 void WrapGetPrintersCallback( | 84 void WrapGetPrintersCallback( |
87 const PrinterHandler::GetPrintersCallback& callback, | 85 const PrinterHandler::GetPrintersCallback& callback, |
88 const base::ListValue& pritners, | 86 const base::ListValue& pritners, |
89 bool done); | 87 bool done); |
90 void WrapGetCapabilityCallback( | 88 void WrapGetCapabilityCallback( |
91 const PrinterHandler::GetCapabilityCallback& callback, | 89 const PrinterHandler::GetCapabilityCallback& callback, |
92 const std::string& destination_id, | 90 const std::string& destination_id, |
93 const base::DictionaryValue& capability); | 91 const base::DictionaryValue& capability); |
94 void WrapPrintCallback(const PrinterHandler::PrintCallback& callback, | 92 void WrapPrintCallback(const PrinterHandler::PrintCallback& callback, |
95 bool success, | 93 bool success, |
96 const std::string& status); | 94 const std::string& status); |
97 | 95 |
98 content::BrowserContext* browser_context_; | 96 content::BrowserContext* browser_context_; |
99 | 97 |
100 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter_; | 98 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter_; |
101 | 99 |
102 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; | 100 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; |
103 | 101 |
104 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); | 102 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); |
105 }; | 103 }; |
106 | 104 |
107 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ | 105 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ |
OLD | NEW |