Daniel Hosseinian | 3881c97a | 2020-03-25 21:41:09 | [diff] [blame] | 1 | // Copyright 2020 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. |
| 4 | |
| 5 | #ifndef PDF_DOCUMENT_METADATA_H_ |
| 6 | #define PDF_DOCUMENT_METADATA_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace chrome_pdf { |
| 11 | |
Daniel Hosseinian | bc31655 | 2020-03-26 05:57:58 | [diff] [blame^] | 12 | // These values are persisted to logs. Entries should not be renumbered and |
| 13 | // numeric values should never be reused. |
| 14 | enum class PdfVersion { |
| 15 | kUnknown = 0, |
| 16 | k1_0 = 1, |
| 17 | k1_1 = 2, |
| 18 | k1_2 = 3, |
| 19 | k1_3 = 4, |
| 20 | k1_4 = 5, |
| 21 | k1_5 = 6, |
| 22 | k1_6 = 7, |
| 23 | k1_7 = 8, |
| 24 | k1_8 = 9, // Not an actual version. Kept for metrics purposes. |
| 25 | k2_0 = 10, |
| 26 | kMaxValue = k2_0 |
| 27 | }; |
| 28 | |
Daniel Hosseinian | 3881c97a | 2020-03-25 21:41:09 | [diff] [blame] | 29 | // Document properties, including those specified in the document information |
| 30 | // dictionary (see section 14.3.3 "Document Information Dictionary" of the ISO |
| 31 | // 32000-1 standard), as well as other properties about the file. |
| 32 | // TODO(crbug.com/93619): Finish adding information dictionary fields like |
Daniel Hosseinian | bc31655 | 2020-03-26 05:57:58 | [diff] [blame^] | 33 | // |keywords|, |creation_date|, and |mod_date|. Also add fields like |
Daniel Hosseinian | 3881c97a | 2020-03-25 21:41:09 | [diff] [blame] | 34 | // |size_bytes|, |is_encrypted|, and |is_linearized|. |
| 35 | struct DocumentMetadata { |
| 36 | DocumentMetadata(); |
| 37 | DocumentMetadata(const DocumentMetadata&) = delete; |
| 38 | DocumentMetadata& operator=(const DocumentMetadata&) = delete; |
| 39 | ~DocumentMetadata(); |
| 40 | |
Daniel Hosseinian | bc31655 | 2020-03-26 05:57:58 | [diff] [blame^] | 41 | // Version of the document |
| 42 | PdfVersion version = PdfVersion::kUnknown; |
| 43 | |
Daniel Hosseinian | 3881c97a | 2020-03-25 21:41:09 | [diff] [blame] | 44 | // The document's title. |
| 45 | std::string title; |
| 46 | |
| 47 | // The name of the document's creator. |
| 48 | std::string author; |
| 49 | |
| 50 | // The document's subject. |
| 51 | std::string subject; |
| 52 | |
| 53 | // The name of the application that created the original document. |
| 54 | std::string creator; |
| 55 | |
| 56 | // If the document's format was not originally PDF, the name of the |
| 57 | // application that converted the document to PDF. |
| 58 | std::string producer; |
| 59 | }; |
| 60 | |
| 61 | } // namespace chrome_pdf |
| 62 | |
| 63 | #endif // PDF_DOCUMENT_METADATA_H_ |