Skip to content

Commit

Permalink
PDFViewerUpdate: Annotation mode dialog fixes
Browse files Browse the repository at this point in the history
- Remove ampersand symbol (&) from IDS_EDIT string before adding to the
  PDF viewer UI.
- Don't toggle annotation mode if dialog is not confirmed
- Strings - remove ending '.' per UX feedback

Bug: 1048876
Change-Id: Ie8afacd21b10595e6c1ef8878ca5091027042224
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429976
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: dpapad <dpapad@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810824}
  • Loading branch information
rbpotter authored and Commit Bot committed Sep 25, 2020
1 parent 102aa7a commit 0fba679
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
7 changes: 6 additions & 1 deletion chrome/browser/pdf/pdf_extension_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void AddPdfViewerStrings(base::Value* dict) {
{"annotationResetTwoPageView", IDS_PDF_ANNOTATION_RESET_TWO_PAGE_VIEW},
{"annotationResetRotateAndTwoPageView",
IDS_PDF_ANNOTATION_RESET_ROTATE_AND_TWO_PAGE_VIEW},
{"editButton", IDS_EDIT},
{"cancelButton", IDS_CANCEL},
{"annotationPen", IDS_PDF_ANNOTATION_PEN},
{"annotationHighlighter", IDS_PDF_ANNOTATION_HIGHLIGHTER},
Expand Down Expand Up @@ -131,6 +130,12 @@ void AddPdfViewerStrings(base::Value* dict) {
for (const auto& resource : kPdfResources)
dict->SetStringKey(resource.name, l10n_util::GetStringUTF16(resource.id));

#if defined(OS_CHROMEOS)
base::string16 edit_string = l10n_util::GetStringUTF16(IDS_EDIT);
base::Erase(edit_string, '&');
dict->SetStringKey("editButton", edit_string);
#endif

webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(),
static_cast<base::DictionaryValue*>(dict));
}
Expand Down
10 changes: 6 additions & 4 deletions chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,15 @@ export class ViewerPdfToolbarNewElement extends PolymerElement {
// <if expr="chromeos">
/** @private */
onDialogClose_() {
if (/** @type {!ViewerAnnotationsModeDialogElement} */ (
const confirmed =
/** @type {!ViewerAnnotationsModeDialogElement} */ (
this.shadowRoot.querySelector('viewer-annotations-mode-dialog'))
.wasConfirmed()) {
.wasConfirmed();
this.showAnnotationsModeDialog_ = false;
if (confirmed) {
this.dispatchEvent(new CustomEvent('annotation-mode-dialog-confirmed'));
this.toggleAnnotation();
}
this.showAnnotationsModeDialog_ = false;
this.toggleAnnotation();
}

/** @private */
Expand Down
6 changes: 3 additions & 3 deletions components/pdf_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@
Edit annotations in default view?
</message>
<message name="IDS_PDF_ANNOTATION_RESET_ROTATE" desc="Text in a dialog informing the user that rotation will be reset to default if they continue to annotation mode">
When you edit annotations, this document will return to its original rotation.
When you edit annotations, this document will return to its original rotation
</message>
<message name="IDS_PDF_ANNOTATION_RESET_TWO_PAGE_VIEW" desc="Text in a dialog informing the user that the view will reset to single page if they continue to annotation mode">
When you edit annotations, this document will return to single page view.
When you edit annotations, this document will return to single page view
</message>
<message name="IDS_PDF_ANNOTATION_RESET_ROTATE_AND_TWO_PAGE_VIEW" desc="Text in a dialog informing the user that rotation will be reset to default and the view will reset to single page if they continue to annotation mode">
When you edit annotations, this document will return to single page view and its original rotation.
When you edit annotations, this document will return to single page view and its original rotation
</message>
<message name="IDS_PDF_ANNOTATION_DOCUMENT_TOO_LARGE" desc="Button tooltip to indicate why 'Annotation mode' which allows writing, drawing and highlighting of the PDF document is not available due to the document being too large">
Document is too large to be annotated
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9388f341e58e71464573cca01fada0b1ccba1184
525f786258dbf0e41fae6aef0794b34e51ad13f3
Original file line number Diff line number Diff line change
@@ -1 +1 @@
074e3b252b8c9255db1753d0d2df7d92c2b38b0b
ebe03b9a3d8f684f8def40211b78420e99e7e509
Original file line number Diff line number Diff line change
@@ -1 +1 @@
086e1d873ed0bbe924d9b7ebea2d6fc4832e78a4
4e2ec648594b741316ffc2d68ede144c2819a2ba

0 comments on commit 0fba679

Please sign in to comment.