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 b6d5caa5d35079af211be6911ac116be1d88236d..838a105e936dfb30efc72fbac24a669d0ad1f8d0 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() { |
|
Sam McNally
2015/01/28 03:04:30
if (this.isMaterial_) {
Alexandre Carlton
2015/01/28 07:16:52
Done.
|
| + this.bookmarksPane.toggle(); |
|
Sam McNally
2015/01/28 03:04:30
Indentation.
Alexandre Carlton
2015/01/28 07:16:52
Done.
|
| + }.bind(this)); |
| // Setup the keyboard event listener. |
| document.onkeydown = this.handleKeyEvent_.bind(this); |
| @@ -436,7 +444,7 @@ PDFViewer.prototype = { |
| chrome.mimeHandlerPrivate.abortStream(); |
| break; |
| case 'bookmarks': |
| - this.bookmarks_ = message.data.bookmarks; |
| + this.bookmarksPane.bookmarks = message.data.bookmarks; |
| break; |
| } |
| }, |
| @@ -684,6 +692,6 @@ PDFViewer.prototype = { |
| * @type {Array} the top-level bookmarks of the PDF. |
| */ |
| get bookmarks() { |
| - return this.bookmarks_; |
| + return this.bookmarksPane.bookmarks; |
|
Sam McNally
2015/01/28 03:04:30
Does this still work if !this.isMaterial_?
Alexandre Carlton
2015/01/28 07:16:52
Would it be best to return an empty list if !this.
|
| } |
| }; |