OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @return {number} Width of a scrollbar in pixels | 8 * @return {number} Width of a scrollbar in pixels |
9 */ | 9 */ |
10 function getScrollbarWidth() { | 10 function getScrollbarWidth() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // to be displayed in the window. It is sized according to the document size | 79 // to be displayed in the window. It is sized according to the document size |
80 // of the pdf and zoom level. | 80 // of the pdf and zoom level. |
81 this.sizer_ = $('sizer'); | 81 this.sizer_ = $('sizer'); |
82 this.toolbar_ = $('toolbar'); | 82 this.toolbar_ = $('toolbar'); |
83 this.pageIndicator_ = $('page-indicator'); | 83 this.pageIndicator_ = $('page-indicator'); |
84 this.progressBar_ = $('progress-bar'); | 84 this.progressBar_ = $('progress-bar'); |
85 this.passwordScreen_ = $('password-screen'); | 85 this.passwordScreen_ = $('password-screen'); |
86 this.passwordScreen_.addEventListener('password-submitted', | 86 this.passwordScreen_.addEventListener('password-submitted', |
87 this.onPasswordSubmitted_.bind(this)); | 87 this.onPasswordSubmitted_.bind(this)); |
88 this.errorScreen_ = $('error-screen'); | 88 this.errorScreen_ = $('error-screen'); |
89 this.toolbarHeight_ = this.isMaterial_ ? $('pdf-toolbar').clientHeight : 0; | |
90 this.bookmarksPane = $('bookmarks-pane'); | 89 this.bookmarksPane = $('bookmarks-pane'); |
91 | 90 |
92 // Create the viewport. | 91 // Create the viewport. |
93 this.viewport_ = new Viewport(window, | 92 this.viewport_ = new Viewport(window, |
94 this.sizer_, | 93 this.sizer_, |
95 this.viewportChanged_.bind(this), | 94 this.viewportChanged_.bind(this), |
96 this.beforeZoom_.bind(this), | 95 this.beforeZoom_.bind(this), |
97 this.afterZoom_.bind(this), | 96 this.afterZoom_.bind(this), |
98 getScrollbarWidth(), | 97 getScrollbarWidth()); |
99 this.toolbarHeight_); | |
100 // Create the plugin object dynamically so we can set its src. The plugin | 98 // Create the plugin object dynamically so we can set its src. The plugin |
101 // element is sized to fill the entire window and is set to be fixed | 99 // element is sized to fill the entire window and is set to be fixed |
102 // positioning, acting as a viewport. The plugin renders into this viewport | 100 // positioning, acting as a viewport. The plugin renders into this viewport |
103 // according to the scroll position of the window. | 101 // according to the scroll position of the window. |
104 this.plugin_ = document.createElement('embed'); | 102 this.plugin_ = document.createElement('embed'); |
105 // NOTE: The plugin's 'id' field must be set to 'plugin' since | 103 // NOTE: The plugin's 'id' field must be set to 'plugin' since |
106 // chrome/renderer/printing/print_web_view_helper.cc actually references it. | 104 // chrome/renderer/printing/print_web_view_helper.cc actually references it. |
107 this.plugin_.id = 'plugin'; | 105 this.plugin_.id = 'plugin'; |
108 this.plugin_.type = 'application/x-google-chrome-pdf'; | 106 this.plugin_.type = 'application/x-google-chrome-pdf'; |
109 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this), | 107 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this), |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 * Each bookmark is an Object containing a: | 753 * Each bookmark is an Object containing a: |
756 * - title | 754 * - title |
757 * - page (optional) | 755 * - page (optional) |
758 * - array of children (themselves bookmarks) | 756 * - array of children (themselves bookmarks) |
759 * @type {Array} the top-level bookmarks of the PDF. | 757 * @type {Array} the top-level bookmarks of the PDF. |
760 */ | 758 */ |
761 get bookmarks() { | 759 get bookmarks() { |
762 return this.bookmarks_; | 760 return this.bookmarks_; |
763 } | 761 } |
764 }; | 762 }; |
OLD | NEW |