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 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "chrome/browser/ui/webui/print_preview/printer_handler.h" | 15 #include "chrome/browser/ui/webui/print_preview/printer_handler.h" |
15 #include "extensions/browser/api/printer_provider/printer_provider_api.h" | 16 #include "extensions/browser/api/printer_provider/printer_provider_api.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class DictionaryValue; | 19 class DictionaryValue; |
19 class ListValue; | 20 class ListValue; |
20 class RefCountedMemory; | 21 class RefCountedMemory; |
21 class TaskRunner; | 22 class TaskRunner; |
22 } | 23 } |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class BrowserContext; | 26 class BrowserContext; |
26 } | 27 } |
27 | 28 |
28 namespace cloud_devices { | 29 namespace cloud_devices { |
29 class CloudDeviceDescription; | 30 class CloudDeviceDescription; |
30 } | 31 } |
31 | 32 |
33 namespace device { | |
34 class UsbDevice; | |
35 } | |
36 | |
32 namespace gfx { | 37 namespace gfx { |
33 class Size; | 38 class Size; |
34 } | 39 } |
35 | 40 |
36 namespace local_discovery { | 41 namespace local_discovery { |
37 class PWGRasterConverter; | 42 class PWGRasterConverter; |
38 } | 43 } |
39 | 44 |
40 // Implementation of PrinterHandler interface backed by printerProvider | 45 // Implementation of PrinterHandler interface backed by printerProvider |
41 // extension API. | 46 // extension API. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 // Sets print job document data and dispatches it using printerProvider API. | 91 // Sets print job document data and dispatches it using printerProvider API. |
87 void DispatchPrintJob( | 92 void DispatchPrintJob( |
88 const PrinterHandler::PrintCallback& callback, | 93 const PrinterHandler::PrintCallback& callback, |
89 scoped_ptr<extensions::PrinterProviderPrintJob> print_job); | 94 scoped_ptr<extensions::PrinterProviderPrintJob> print_job); |
90 | 95 |
91 // Methods used as wrappers to callbacks for extensions::PrinterProviderAPI | 96 // Methods used as wrappers to callbacks for extensions::PrinterProviderAPI |
92 // methods, primarily so the callbacks can be bound to this class' weak ptr. | 97 // methods, primarily so the callbacks can be bound to this class' weak ptr. |
93 // They just propagate results to callbacks passed to them. | 98 // They just propagate results to callbacks passed to them. |
94 void WrapGetPrintersCallback( | 99 void WrapGetPrintersCallback( |
95 const PrinterHandler::GetPrintersCallback& callback, | 100 const PrinterHandler::GetPrintersCallback& callback, |
96 const base::ListValue& pritners, | 101 const base::ListValue& printers, |
97 bool done); | 102 bool done); |
98 void WrapGetCapabilityCallback( | 103 void WrapGetCapabilityCallback( |
99 const PrinterHandler::GetCapabilityCallback& callback, | 104 const PrinterHandler::GetCapabilityCallback& callback, |
100 const std::string& destination_id, | 105 const std::string& destination_id, |
101 const base::DictionaryValue& capability); | 106 const base::DictionaryValue& capability); |
102 void WrapPrintCallback(const PrinterHandler::PrintCallback& callback, | 107 void WrapPrintCallback(const PrinterHandler::PrintCallback& callback, |
103 bool success, | 108 bool success, |
104 const std::string& status); | 109 const std::string& status); |
110 void OnUsbDevicesEnumerated( | |
111 const PrinterHandler::GetPrintersCallback& callback, | |
112 const std::vector<scoped_refptr<device::UsbDevice>>& devices); | |
105 | 113 |
106 content::BrowserContext* browser_context_; | 114 content::BrowserContext* browser_context_; |
107 | 115 |
108 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter_; | 116 scoped_ptr<local_discovery::PWGRasterConverter> pwg_raster_converter_; |
117 bool printer_enumeration_complete_ = false; | |
118 bool wait_for_usb_enumeration_ = false; | |
tbarzic
2015/05/28 00:20:00
nit:
usb_enumeration_complete_ to be consistent
| |
109 | 119 |
110 scoped_refptr<base::TaskRunner> slow_task_runner_; | 120 scoped_refptr<base::TaskRunner> slow_task_runner_; |
111 | 121 |
112 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; | 122 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; |
113 | 123 |
114 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); | 124 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); |
115 }; | 125 }; |
116 | 126 |
117 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ | 127 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ |
OLD | NEW |