Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: chrome/browser/ui/webui/print_preview/extension_printer_handler.h

Issue 1153173002: Include USB printers in printer list as "provisional" devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed more comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/extension_printer_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 int pending_enumeration_count_ = 0;
109 118
110 scoped_refptr<base::TaskRunner> slow_task_runner_; 119 scoped_refptr<base::TaskRunner> slow_task_runner_;
111 120
112 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; 121 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_;
113 122
114 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); 123 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler);
115 }; 124 };
116 125
117 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ 126 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/extension_printer_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698