Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 */ | 88 */ | 
| 89 PDFViewer.MIN_TOOLBAR_OFFSET = 15; | 89 PDFViewer.MIN_TOOLBAR_OFFSET = 15; | 
| 90 | 90 | 
| 91 /** | 91 /** | 
| 92 * The height of the toolbar along the top of the page. The document will be | 92 * The height of the toolbar along the top of the page. The document will be | 
| 93 * shifted down by this much in the viewport. | 93 * shifted down by this much in the viewport. | 
| 94 */ | 94 */ | 
| 95 PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56; | 95 PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56; | 
| 96 | 96 | 
| 97 /** | 97 /** | 
| 98 * Minimum height for the material toolbar to show (px). Should match the media | |
| 99 * query in index-material.css. If the window is smaller than this at load, | |
| 100 * leave no space for the toolbar. | |
| 101 */ | |
| 102 PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT = 250; | |
| 103 | |
| 104 /** | |
| 98 * The light-gray background color used for print preview. | 105 * The light-gray background color used for print preview. | 
| 99 */ | 106 */ | 
| 100 PDFViewer.LIGHT_BACKGROUND_COLOR = '0xFFCCCCCC'; | 107 PDFViewer.LIGHT_BACKGROUND_COLOR = '0xFFCCCCCC'; | 
| 101 | 108 | 
| 102 /** | 109 /** | 
| 103 * The dark-gray background color used for the regular viewer. | 110 * The dark-gray background color used for the regular viewer. | 
| 104 */ | 111 */ | 
| 105 PDFViewer.DARK_BACKGROUND_COLOR = '0xFF525659'; | 112 PDFViewer.DARK_BACKGROUND_COLOR = '0xFF525659'; | 
| 106 | 113 | 
| 107 /** | 114 /** | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 136 this.onPasswordSubmitted_.bind(this)); | 143 this.onPasswordSubmitted_.bind(this)); | 
| 137 this.errorScreen_ = $('error-screen'); | 144 this.errorScreen_ = $('error-screen'); | 
| 138 // Can only reload if we are in a normal tab. | 145 // Can only reload if we are in a normal tab. | 
| 139 if (chrome.tabs && this.browserApi_.getStreamInfo().tabId != -1) { | 146 if (chrome.tabs && this.browserApi_.getStreamInfo().tabId != -1) { | 
| 140 this.errorScreen_.reloadFn = function() { | 147 this.errorScreen_.reloadFn = function() { | 
| 141 chrome.tabs.reload(this.browserApi_.getStreamInfo().tabId); | 148 chrome.tabs.reload(this.browserApi_.getStreamInfo().tabId); | 
| 142 }.bind(this); | 149 }.bind(this); | 
| 143 } | 150 } | 
| 144 | 151 | 
| 145 // Create the viewport. | 152 // Create the viewport. | 
| 153 var shortWindow = window.innerHeight < PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT; | |
| 
 
raymes
2015/09/28 07:42:45
Perhaps we should set the toolbar to display none
 
tsergeant
2015/09/30 01:26:48
The media query is nice because it automatically u
 
 | |
| 146 var topToolbarHeight = | 154 var topToolbarHeight = | 
| 147 (this.isMaterial_ && !this.isPrintPreview_) ? | 155 (this.isMaterial_ && !this.isPrintPreview_ && !shortWindow) ? | 
| 148 PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0; | 156 PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0; | 
| 149 this.viewport_ = new Viewport(window, | 157 this.viewport_ = new Viewport(window, | 
| 150 this.sizer_, | 158 this.sizer_, | 
| 151 this.viewportChanged_.bind(this), | 159 this.viewportChanged_.bind(this), | 
| 152 this.beforeZoom_.bind(this), | 160 this.beforeZoom_.bind(this), | 
| 153 this.afterZoom_.bind(this), | 161 this.afterZoom_.bind(this), | 
| 154 getScrollbarWidth(), | 162 getScrollbarWidth(), | 
| 155 this.browserApi_.getDefaultZoom(), | 163 this.browserApi_.getDefaultZoom(), | 
| 156 topToolbarHeight); | 164 topToolbarHeight); | 
| 157 | 165 | 
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 * Each bookmark is an Object containing a: | 929 * Each bookmark is an Object containing a: | 
| 922 * - title | 930 * - title | 
| 923 * - page (optional) | 931 * - page (optional) | 
| 924 * - array of children (themselves bookmarks) | 932 * - array of children (themselves bookmarks) | 
| 925 * @type {Array} the top-level bookmarks of the PDF. | 933 * @type {Array} the top-level bookmarks of the PDF. | 
| 926 */ | 934 */ | 
| 927 get bookmarks() { | 935 get bookmarks() { | 
| 928 return this.bookmarks_; | 936 return this.bookmarks_; | 
| 929 } | 937 } | 
| 930 }; | 938 }; | 
| OLD | NEW |