fixup! [M120 Migration][NaCl][PPFWK] Upgradable pepper plugin requirement
[platform/framework/web/chromium-efl.git] / pdf / document_metadata.h
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PDF_DOCUMENT_METADATA_H_
6 #define PDF_DOCUMENT_METADATA_H_
7
8 #include <string>
9
10 #include "base/time/time.h"
11
12 namespace chrome_pdf {
13
14 // These values are persisted to logs. Entries should not be renumbered and
15 // numeric values should never be reused.
16 enum class PdfVersion {
17   kUnknown = 0,
18   k1_0 = 1,
19   k1_1 = 2,
20   k1_2 = 3,
21   k1_3 = 4,
22   k1_4 = 5,
23   k1_5 = 6,
24   k1_6 = 7,
25   k1_7 = 8,
26   k1_8 = 9,  // Not an actual version. Kept for metrics purposes.
27   k2_0 = 10,
28   kMaxValue = k2_0
29 };
30
31 // These values are persisted to logs. Entries should not be renumbered and
32 // numeric values should never be reused.
33 enum class FormType {
34   kNone = 0,
35   kAcroForm = 1,
36   kXFAFull = 2,
37   kXFAForeground = 3,
38   kMaxValue = kXFAForeground
39 };
40
41 // Document properties, including those specified in the document information
42 // dictionary (see section 14.3.3 "Document Information Dictionary" of the ISO
43 // 32000-1:2008 spec).
44 struct DocumentMetadata {
45   DocumentMetadata();
46   DocumentMetadata(const DocumentMetadata&) = delete;
47   DocumentMetadata& operator=(const DocumentMetadata&) = delete;
48   ~DocumentMetadata();
49
50   // Version of the document.
51   PdfVersion version = PdfVersion::kUnknown;
52
53   // The size of the document in bytes.
54   size_t size_bytes = 0;
55
56   // Number of pages in the document.
57   size_t page_count = 0;
58
59   // Whether the document is optimized by linearization (see annex F "Linearized
60   // PDF" of the ISO 32000-1:2008 spec).
61   bool linearized = false;
62
63   // Whether the document contains file attachments (see section 12.5.6.15 "File
64   // Attachment Annotations" of the ISO 32000-1:2008 spec).
65   bool has_attachments = false;
66
67   // The type of form contained in the document.
68   FormType form_type = FormType::kNone;
69
70   // The document's title.
71   std::string title;
72
73   // The name of the document's creator.
74   std::string author;
75
76   // The document's subject.
77   std::string subject;
78
79   // The document's keywords.
80   std::string keywords;
81
82   // The name of the application that created the original document.
83   std::string creator;
84
85   // If the document's format was not originally PDF, the name of the
86   // application that converted the document to PDF.
87   std::string producer;
88
89   // The date and time the document was created.
90   base::Time creation_date;
91
92   // The date and time the document was most recently modified.
93   base::Time mod_date;
94 };
95
96 }  // namespace chrome_pdf
97
98 #endif  // PDF_DOCUMENT_METADATA_H_