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

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

Issue 865033002: Implement a slide-in pane for bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pdf-pane
Patch Set: Adjust indentation 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
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index 007d3dca37ad967d7be2be9803a3b4eb05813e6f..a03fbc9e04d83bf907f614082e57418038783d81 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -66,6 +66,7 @@ function PDFViewer(streamDetails) {
this.onPasswordSubmitted_.bind(this));
this.errorScreen_ = $('error-screen');
this.toolbarHeight_ = this.isMaterial_ ? $('pdf-toolbar').clientHeight : 0;
+ this.bookmarksPane = $('bookmarks-pane');
// Create the viewport.
this.viewport_ = new Viewport(window,
@@ -112,6 +113,10 @@ function PDFViewer(streamDetails) {
this.plugin_.setAttribute('full-frame', '');
document.body.appendChild(this.plugin_);
+ this.bookmarksPane.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_));
@@ -123,6 +128,9 @@ function PDFViewer(streamDetails) {
this.viewport_.zoomOut.bind(this.viewport_));
$('save-button').addEventListener('click', this.save_.bind(this));
$('print-button').addEventListener('click', this.print_.bind(this));
+ $('bookmarks-button').addEventListener('click', function() {
+ this.bookmarksPane.toggle();
+ }.bind(this));
// Setup the keyboard event listener.
document.onkeydown = this.handleKeyEvent_.bind(this);
@@ -434,6 +442,7 @@ PDFViewer.prototype = {
break;
case 'bookmarks':
this.bookmarks_ = message.data.bookmarks;
+ this.bookmarksPane.bookmarks = message.data.bookmarks;
raymes 2015/01/27 09:10:54 Do we use "this.bookmarks_"? I think we just used
Alexandre Carlton 2015/01/28 00:22:47 Done.
break;
}
},

Powered by Google App Engine
This is Rietveld 408576698