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_PRINTER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 class ListValue; | 16 class ListValue; |
17 class RefCountedMemory; | 17 class RefCountedMemory; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class BrowserContext; | 21 class BrowserContext; |
22 } | 22 } |
23 | 23 |
| 24 namespace gfx { |
| 25 class Size; |
| 26 } |
| 27 |
24 // Wrapper around PrinterProviderAPI to be used by print preview. | 28 // Wrapper around PrinterProviderAPI to be used by print preview. |
25 // It makes request lifetime management easier, and hides details of more | 29 // It makes request lifetime management easier, and hides details of more |
26 // complex operations like printing from the print preview handler. | 30 // complex operations like printing from the print preview handler. |
27 // TODO(tbarzic): Use the same interface for other printer types. | 31 // TODO(tbarzic): Use the same interface for other printer types. |
28 class PrinterHandler { | 32 class PrinterHandler { |
29 public: | 33 public: |
30 using GetPrintersCallback = | 34 using GetPrintersCallback = |
31 base::Callback<void(const base::ListValue& printers, bool done)>; | 35 base::Callback<void(const base::ListValue& printers, bool done)>; |
32 using GetCapabilityCallback = | 36 using GetCapabilityCallback = |
33 base::Callback<void(const std::string& printer_id, | 37 base::Callback<void(const std::string& printer_id, |
(...skipping 23 matching lines...) Expand all Loading... |
57 // Starts a print request. | 61 // Starts a print request. |
58 // |destination_id|: The printer to which print job should be sent. | 62 // |destination_id|: The printer to which print job should be sent. |
59 // |capability|: Capability reported by the printer. | 63 // |capability|: Capability reported by the printer. |
60 // |ticket_json|: The print job ticket as JSON string. | 64 // |ticket_json|: The print job ticket as JSON string. |
61 // |print_data|: The document bytes to print. | 65 // |print_data|: The document bytes to print. |
62 // |callback| should be called in the response to the request. | 66 // |callback| should be called in the response to the request. |
63 virtual void StartPrint( | 67 virtual void StartPrint( |
64 const std::string& destination_id, | 68 const std::string& destination_id, |
65 const std::string& capability, | 69 const std::string& capability, |
66 const std::string& ticket_json, | 70 const std::string& ticket_json, |
| 71 const gfx::Size& size, |
67 const scoped_refptr<base::RefCountedMemory>& print_data, | 72 const scoped_refptr<base::RefCountedMemory>& print_data, |
68 const PrintCallback& callback) = 0; | 73 const PrintCallback& callback) = 0; |
69 }; | 74 }; |
70 | 75 |
71 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ | 76 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ |
OLD | NEW |