Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 1329213002: PDF: Use chrome.resourcesPrivate instead of Pepper to display translated strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i18n_api
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index 6d6411e3e91363828d7dea1c2327fd0f9b7d4ba0..45d552f428970768bdb2627bf7004b77e9270c5f 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -243,6 +243,9 @@ function PDFViewer(browserApi) {
onNavigateInCurrentTab, onNavigateInNewTab);
this.viewportScroller_ =
new ViewportScroller(this.viewport_, this.plugin_, window);
+
+ // Request translated strings.
+ chrome.i18nPrivate.getStrings('pdf', this.handleStrings_.bind(this));
}
PDFViewer.prototype = {
@@ -522,6 +525,16 @@ PDFViewer.prototype = {
}
},
+ handleStrings_: function(strings) {
raymes 2015/09/17 03:56:43 nit: add some jsdoc
+ this.passwordScreen_.text = strings.passwordPrompt;
+ if (!this.isMaterial_) {
+ this.progressBar_.text = strings.pageLoading;
+ if (!this.isPrintPreview_)
+ this.progressBar_.style.visibility = 'visible';
+ }
+ this.errorScreen_.text = strings.pageLoadFailed;
+ },
+
/**
* @private
* An event handler for handling password-submitted events. These are fired
@@ -599,15 +612,6 @@ PDFViewer.prototype = {
position.y = message.data.y;
this.viewport_.position = position;
break;
- case 'setTranslatedStrings':
- this.passwordScreen_.text = message.data.getPasswordString;
- if (!this.isMaterial_) {
- this.progressBar_.text = message.data.loadingString;
- if (!this.isPrintPreview_)
- this.progressBar_.style.visibility = 'visible';
- }
- this.errorScreen_.text = message.data.loadFailedString;
- break;
case 'cancelStreamUrl':
chrome.mimeHandlerPrivate.abortStream();
break;

Powered by Google App Engine
This is Rietveld 408576698