Commit 6ecbf733 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Chromium LUCI CQ

PDF Viewer Update: Show creation and modification dates among properties

The displayed dates and times are localized.

Bug: 93619
Change-Id: I116faa499866a828f53142237983bba6645508a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610627
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843434}
parent 47205f1e
...@@ -21,9 +21,11 @@ export const DisplayAnnotationsAction = { ...@@ -21,9 +21,11 @@ export const DisplayAnnotationsAction = {
* @typedef {{ * @typedef {{
* author: string, * author: string,
* canSerializeDocument: boolean, * canSerializeDocument: boolean,
* creationDate: string,
* creator: string, * creator: string,
* keywords: string, * keywords: string,
* linearized: boolean, * linearized: boolean,
* modDate: string,
* producer: string, * producer: string,
* subject: string, * subject: string,
* title: string, * title: string,
......
...@@ -79,11 +79,15 @@ ...@@ -79,11 +79,15 @@
</tr> </tr>
<tr> <tr>
<td class="name">$i18n{propertiesCreated}</td> <td class="name">$i18n{propertiesCreated}</td>
<td class="value" id="created">-</td> <td class="value" id="created">
[[getOrPlaceholder_(documentMetadata.creationDate)]]
</td>
</tr> </tr>
<tr> <tr>
<td class="name">$i18n{propertiesModified}</td> <td class="name">$i18n{propertiesModified}</td>
<td class="value" id="modified">-</td> <td class="value" id="modified">
[[getOrPlaceholder_(documentMetadata.modDate)]]
</td>
</tr> </tr>
<tr class="break"> <tr class="break">
<td class="name">$i18n{propertiesApplication}</td> <td class="name">$i18n{propertiesApplication}</td>
......
...@@ -55,8 +55,8 @@ const tests = [ ...@@ -55,8 +55,8 @@ const tests = [
['author', 'Chromium Authors'], ['author', 'Chromium Authors'],
['subject', 'Testing'], ['subject', 'Testing'],
['keywords', 'testing,chromium,pdfium,document,info'], ['keywords', 'testing,chromium,pdfium,document,info'],
['created', '-'], ['created', '2/5/20, 7:39:12 AM'],
['modified', '-'], ['modified', '2/6/20, 1:42:34 AM'],
['application', 'Your Preferred Text Editor'], ['application', 'Your Preferred Text Editor'],
['pdf-producer', 'fixup_pdf_template.py'], ['pdf-producer', 'fixup_pdf_template.py'],
['pdf-version', '1.7'], ['pdf-version', '1.7'],
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/i18n/number_formatting.h" #include "base/i18n/number_formatting.h"
#include "base/i18n/time_formatting.h"
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -139,6 +140,8 @@ constexpr char kJSSubject[] = "subject"; ...@@ -139,6 +140,8 @@ constexpr char kJSSubject[] = "subject";
constexpr char kJSKeywords[] = "keywords"; constexpr char kJSKeywords[] = "keywords";
constexpr char kJSCreator[] = "creator"; constexpr char kJSCreator[] = "creator";
constexpr char kJSProducer[] = "producer"; constexpr char kJSProducer[] = "producer";
constexpr char kJSCreationDate[] = "creationDate";
constexpr char kJSModDate[] = "modDate";
constexpr char kJSCanSerializeDocument[] = "canSerializeDocument"; constexpr char kJSCanSerializeDocument[] = "canSerializeDocument";
// Get password (Plugin -> Page) // Get password (Plugin -> Page)
constexpr char kJSGetPasswordType[] = "getPassword"; constexpr char kJSGetPasswordType[] = "getPassword";
...@@ -2455,6 +2458,20 @@ void OutOfProcessInstance::SendMetadata() { ...@@ -2455,6 +2458,20 @@ void OutOfProcessInstance::SendMetadata() {
pp::Var(document_metadata.producer)); pp::Var(document_metadata.producer));
} }
if (!document_metadata.creation_date.is_null()) {
metadata_data.Set(
pp::Var(kJSCreationDate),
pp::Var(base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(
document_metadata.creation_date))));
}
if (!document_metadata.mod_date.is_null()) {
metadata_data.Set(
pp::Var(kJSModDate),
pp::Var(base::UTF16ToUTF8(
base::TimeFormatShortDateAndTime(document_metadata.mod_date))));
}
metadata_data.Set( metadata_data.Set(
pp::Var(kJSCanSerializeDocument), pp::Var(kJSCanSerializeDocument),
pp::Var(IsSaveDataSizeValid(engine()->GetLoadedByteSize()))); pp::Var(IsSaveDataSizeValid(engine()->GetLoadedByteSize())));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment