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 EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ |
6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ | 6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
13 | 14 |
14 namespace extensions { | 15 namespace extensions { |
15 | 16 |
16 // Struct describing print job that should be forwarded to an extension via | 17 // Struct describing print job that should be forwarded to an extension via |
17 // chrome.printerProvider.onPrintRequested event. | 18 // chrome.printerProvider.onPrintRequested event. |
| 19 // TODO(tbarzic): This should probably be a class and have some methods, e.g. |
| 20 // whether the job is initialized and whether the data is described using a file |
| 21 // or bytes. |
18 struct PrinterProviderPrintJob { | 22 struct PrinterProviderPrintJob { |
19 PrinterProviderPrintJob(); | 23 PrinterProviderPrintJob(); |
20 ~PrinterProviderPrintJob(); | 24 ~PrinterProviderPrintJob(); |
21 | 25 |
22 // The id of the printer that should handle the print job. The id is | 26 // The id of the printer that should handle the print job. The id is |
23 // formatted as <extension_id>:<printer_id>, where <extension_id> is the | 27 // formatted as <extension_id>:<printer_id>, where <extension_id> is the |
24 // id of the extension that manages the printer, and <printer_id> is | 28 // id of the extension that manages the printer, and <printer_id> is |
25 // the the printer's id within the extension (as reported via | 29 // the the printer's id within the extension (as reported via |
26 // chrome.printerProvider.onGetPrintersRequested event callback). | 30 // chrome.printerProvider.onGetPrintersRequested event callback). |
27 std::string printer_id; | 31 std::string printer_id; |
28 | 32 |
29 // The print job ticket. | 33 // The print job ticket. |
30 std::string ticket_json; | 34 std::string ticket_json; |
31 | 35 |
32 // Content type of the document that should be printed. | 36 // Content type of the document that should be printed. |
33 std::string content_type; | 37 std::string content_type; |
34 | 38 |
35 // The document data that should be printed. | 39 // The document data that should be printed. Should be NULL if document data |
| 40 // is kept in a file. |
36 scoped_refptr<base::RefCountedMemory> document_bytes; | 41 scoped_refptr<base::RefCountedMemory> document_bytes; |
37 | 42 |
38 private: | 43 // Path of the file which contains data to be printed. Should be set only if |
39 DISALLOW_COPY_AND_ASSIGN(PrinterProviderPrintJob); | 44 // |document_bytes| are NULL. |
| 45 base::FilePath document_path; |
| 46 |
| 47 // Information about the file which contains data to be printed. Should be |
| 48 // set only if |document_path| is set. |
| 49 base::File::Info file_info; |
40 }; | 50 }; |
41 | 51 |
42 } // namespace extensions | 52 } // namespace extensions |
43 | 53 |
44 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ | 54 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_PRINT_JOB_H_ |
OLD | NEW |