Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index c9a6e0d119ece677857e0dc69c150b28989774c4..a51e19faa50af82ed847bfbfc550667f8348478a 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -20,29 +20,45 @@ var gSizer; |
// The toolbar element. |
var gViewerToolbar; |
+// The page indicator element. |
+var gViewerPageIndicator; |
+ |
+// The progress bar element. |
+var gViewerProgressBar; |
+ |
// The viewport object. |
var gViewport; |
// Returns true if the fit-to-page button is enabled. |
function isFitToPageEnabled() { |
- return $('btn-ftp').classList.contains('polymer-selected'); |
+ return $('fit-to-page-button').classList.contains('polymer-selected'); |
} |
// Called when a message is received from the plugin. |
function handleMessage(message) { |
if (message.data.type == 'documentDimensions') { |
gViewport.setDocumentDimensions(message.data); |
+ } else if (message.data.type == 'loadProgress') { |
+ gViewerProgressBar.progress = message.data['progress']; |
} |
} |
// Callback that's called when the viewport changes. |
-function viewportChangedCallback(zoom, x, y, scrollbarWidth, hasScrollbars) { |
+function viewportChangedCallback(zoom, |
+ x, |
+ y, |
+ scrollbarWidth, |
+ hasScrollbars, |
+ page) { |
// Offset the toolbar position so that it doesn't move if scrollbars appear. |
var toolbarRight = hasScrollbars.y ? 0 : scrollbarWidth; |
var toolbarBottom = hasScrollbars.x ? 0 : scrollbarWidth; |
gViewerToolbar.style.right = toolbarRight + 'px'; |
gViewerToolbar.style.bottom = toolbarBottom + 'px'; |
+ // Update the most visible page. |
+ gViewerPageIndicator.text = page + 1; |
+ |
// Notify the plugin of the viewport change. |
gPlugin.postMessage({ |
type: 'viewport', |
@@ -92,6 +108,8 @@ function load() { |
function() { gViewport.zoomOut(); }); |
gViewerToolbar = $('toolbar'); |
+ gViewerPageIndicator = $('page-indicator'); |
+ gViewerProgressBar = $('progress-bar'); |
// Setup keyboard event listeners. |
document.onkeydown = function(e) { |