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