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

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

Issue 138703009: Hookup the page-indicator and progress-bar elements in the PDF extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 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) {

Powered by Google App Engine
This is Rietveld 408576698