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

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

Issue 2604923002: Use TaskScheduler instead of WorkerPool in extension_printer_handler.cc. (Closed)
Patch Set: explicit Created 3 years, 12 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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "chrome/browser/ui/webui/print_preview/printer_handler.h" 15 #include "chrome/browser/ui/webui/print_preview/printer_handler.h"
16 #include "extensions/browser/api/printer_provider/printer_provider_api.h" 16 #include "extensions/browser/api/printer_provider/printer_provider_api.h"
17 17
18 namespace base { 18 namespace base {
19 class DictionaryValue; 19 class DictionaryValue;
20 class ListValue; 20 class ListValue;
21 class RefCountedMemory; 21 class RefCountedMemory;
22 class TaskRunner;
23 } 22 }
24 23
25 namespace content { 24 namespace content {
26 class BrowserContext; 25 class BrowserContext;
27 } 26 }
28 27
29 namespace cloud_devices { 28 namespace cloud_devices {
30 class CloudDeviceDescription; 29 class CloudDeviceDescription;
31 } 30 }
32 31
33 namespace device { 32 namespace device {
34 class UsbDevice; 33 class UsbDevice;
35 } 34 }
36 35
37 namespace gfx { 36 namespace gfx {
38 class Size; 37 class Size;
39 } 38 }
40 39
41 namespace printing { 40 namespace printing {
42 class PWGRasterConverter; 41 class PWGRasterConverter;
43 } 42 }
44 43
45 // Implementation of PrinterHandler interface backed by printerProvider 44 // Implementation of PrinterHandler interface backed by printerProvider
46 // extension API. 45 // extension API.
47 class ExtensionPrinterHandler : public PrinterHandler { 46 class ExtensionPrinterHandler : public PrinterHandler {
48 public: 47 public:
49 using PrintJobCallback = base::Callback<void( 48 using PrintJobCallback = base::Callback<void(
50 std::unique_ptr<extensions::PrinterProviderPrintJob>)>; 49 std::unique_ptr<extensions::PrinterProviderPrintJob>)>;
51 50
52 ExtensionPrinterHandler( 51 explicit ExtensionPrinterHandler(content::BrowserContext* browser_context);
53 content::BrowserContext* browser_context,
54 const scoped_refptr<base::TaskRunner>& slow_task_runner);
55 52
56 ~ExtensionPrinterHandler() override; 53 ~ExtensionPrinterHandler() override;
57 54
58 // PrinterHandler implementation: 55 // PrinterHandler implementation:
59 void Reset() override; 56 void Reset() override;
60 void StartGetPrinters( 57 void StartGetPrinters(
61 const PrinterHandler::GetPrintersCallback& callback) override; 58 const PrinterHandler::GetPrintersCallback& callback) override;
62 void StartGetCapability( 59 void StartGetCapability(
63 const std::string& destination_id, 60 const std::string& destination_id,
64 const PrinterHandler::GetCapabilityCallback& calback) override; 61 const PrinterHandler::GetCapabilityCallback& calback) override;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 112
116 void OnUsbDevicesEnumerated( 113 void OnUsbDevicesEnumerated(
117 const PrinterHandler::GetPrintersCallback& callback, 114 const PrinterHandler::GetPrintersCallback& callback,
118 const std::vector<scoped_refptr<device::UsbDevice>>& devices); 115 const std::vector<scoped_refptr<device::UsbDevice>>& devices);
119 116
120 content::BrowserContext* browser_context_; 117 content::BrowserContext* browser_context_;
121 118
122 std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter_; 119 std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter_;
123 int pending_enumeration_count_ = 0; 120 int pending_enumeration_count_ = 0;
124 121
125 scoped_refptr<base::TaskRunner> slow_task_runner_;
126
127 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_; 122 base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_;
128 123
129 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler); 124 DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandler);
130 }; 125 };
131 126
132 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_EXTENSION_PRINTER_HANDLER_H_ 127 #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