Chromium Code Reviews| Index: chrome/browser/resources/pdf/pdf.js |
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
| index e9ae848d5d19c21266390ed0f14faeed451304a2..14291041f00d937b97bd1b295820f6e9d2332bfd 100644 |
| --- a/chrome/browser/resources/pdf/pdf.js |
| +++ b/chrome/browser/resources/pdf/pdf.js |
| @@ -111,6 +111,10 @@ function PDFViewer(streamDetails) { |
| this.plugin_.setAttribute('full-frame', ''); |
| document.body.appendChild(this.plugin_); |
| + this.pageIndicator_.addEventListener('changePage', function(e) { |
| + this.viewport_.goToPage(e.detail.page); |
| + }.bind(this)); |
| + |
| // Setup the button event listeners. |
| $('fit-to-width-button').addEventListener('click', |
| this.viewport_.fitToWidth.bind(this.viewport_)); |
| @@ -291,6 +295,24 @@ PDFViewer.prototype = { |
| /** |
| * @private |
| + * Advance the page. |
| + */ |
| + goToNextPage_: function() { |
|
Sam McNally
2015/01/21 04:03:38
Are these used?
Alexandre Carlton
2015/01/21 05:20:35
Removed.
|
| + var currentPage = this.viewport_.getMostVisiblePage(); |
| + this.viewport_.goToPage(currentPage + 1); |
| + }, |
| + |
| + /** |
| + * @private |
| + * Go back a page. |
| + */ |
| + goToPreviousPage_: function() { |
| + var currentPage = this.viewport_.getMostVisiblePage(); |
| + this.viewport_.goToPage(currentPage - 1); |
| + }, |
| + |
| + /** |
| + * @private |
| * Handle open pdf parameters. This function updates the viewport as per |
| * the parameters mentioned in the url while opening pdf. The order is |
| * important as later actions can override the effects of previous actions. |
| @@ -337,6 +359,8 @@ PDFViewer.prototype = { |
| // Document load complete. |
| if (this.lastViewportPosition_) |
| this.viewport_.position = this.lastViewportPosition_; |
| + if (this.isMaterial_) |
| + this.pageIndicator_.style.visibility = 'visible'; |
| this.handleURLParams_(); |
| this.loaded_ = true; |
| this.sendScriptingMessage_({ |
| @@ -435,7 +459,13 @@ PDFViewer.prototype = { |
| if (this.passwordScreen_.active) |
| this.passwordScreen_.accept(); |
| - this.pageIndicator_.initialFadeIn(); |
| + if (this.isMaterial_) { |
| + this.pageIndicator_.docLength = |
|
Sam McNally
2015/01/21 04:03:38
Indentation.
Alexandre Carlton
2015/01/21 05:20:35
Done.
|
| + this.documentDimensions_.pageDimensions.length; |
| + } else { |
| + this.pageIndicator_.initialFadeIn(); |
| + } |
| + |
| this.toolbar_.initialFadeIn(); |
| break; |
| case 'email': |
| @@ -591,11 +621,13 @@ PDFViewer.prototype = { |
| // Update the page indicator. |
| var visiblePage = this.viewport_.getMostVisiblePage(); |
| this.pageIndicator_.index = visiblePage; |
| - if (this.documentDimensions_.pageDimensions.length > 1 && |
| - hasScrollbars.vertical) { |
| - this.pageIndicator_.style.visibility = 'visible'; |
| - } else { |
| - this.pageIndicator_.style.visibility = 'hidden'; |
| + if (!this.isMaterial_) { |
| + if (this.documentDimensions_.pageDimensions.length > 1 && |
| + hasScrollbars.vertical) { |
| + this.pageIndicator_.style.visibility = 'visible'; |
| + } else { |
| + this.pageIndicator_.style.visibility = 'hidden'; |
| + } |
| } |
| var visiblePageDimensions = this.viewport_.getPageScreenRect(visiblePage); |