Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index c8753e14a6207dca698cd16144c70cb57dba82f9..010f83f5c2c452d691dfc63eeb914a78a967e5cb 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -255,6 +255,9 @@ function PDFViewer(browserApi) { |
onNavigateInCurrentTab, onNavigateInNewTab); |
this.viewportScroller_ = |
new ViewportScroller(this.viewport_, this.plugin_, window); |
+ |
+ // Request translated strings. |
+ chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); |
} |
PDFViewer.prototype = { |
@@ -539,6 +542,22 @@ PDFViewer.prototype = { |
/** |
* @private |
+ * Load a dictionary of translated strings into the UI. Used as a callback for |
+ * chrome.resourcesPrivate. |
+ * @param {Object} strings Dictionary of translated strings |
+ */ |
+ handleStrings_: function(strings) { |
+ 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 |
* when an event is entered into the password screen. |
* @param {Object} event a password-submitted event. |
@@ -618,15 +637,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; |