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

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

Issue 861673002: Implement Page Selection in PDF Toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pdf-toolbar
Patch Set: Restore viewer-progress-bar in index.html Created 5 years, 11 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
« no previous file with comments | « chrome/browser/resources/pdf/index-material.html ('k') | ui/webui/resources/polymer_resources.grdp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index a207c9ebb48abd42b682148002e214b8d8f1a221..fb4d3ee53a3d7d19b7c918089fcc09b3de7097a1 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -112,6 +112,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_));
@@ -340,6 +344,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_({
@@ -378,7 +384,13 @@ PDFViewer.prototype = {
if (this.passwordScreen_.active)
this.passwordScreen_.accept();
- this.pageIndicator_.initialFadeIn();
+ if (this.isMaterial_) {
+ this.pageIndicator_.docLength =
+ this.documentDimensions_.pageDimensions.length;
+ } else {
+ this.pageIndicator_.initialFadeIn();
+ }
+
this.toolbar_.initialFadeIn();
break;
case 'email':
@@ -535,11 +547,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);
« no previous file with comments | « chrome/browser/resources/pdf/index-material.html ('k') | ui/webui/resources/polymer_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698