OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Creates a PreviewArea object. It represents the area where the preview | 9 * Creates a PreviewArea object. It represents the area where the preview |
10 * document is displayed. | 10 * document is displayed. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 * @return {boolean} Whether the preview area has a compatible plugin to | 223 * @return {boolean} Whether the preview area has a compatible plugin to |
224 * display the print preview in. | 224 * display the print preview in. |
225 */ | 225 */ |
226 get hasCompatiblePlugin() { | 226 get hasCompatiblePlugin() { |
227 return this.previewGenerator_ != null; | 227 return this.previewGenerator_ != null; |
228 }, | 228 }, |
229 | 229 |
230 /** | 230 /** |
231 * Processes a keyboard event that could possibly be used to change state of | 231 * Processes a keyboard event that could possibly be used to change state of |
232 * the preview plugin. | 232 * the preview plugin. |
233 * @param {MouseEvent} e Mouse event to process. | 233 * @param {KeyboardEvent} e Keyboard event to process. |
234 */ | 234 */ |
235 handleDirectionalKeyEvent: function(e) { | 235 handleDirectionalKeyEvent: function(e) { |
236 // Make sure the PDF plugin is there. | 236 // Make sure the PDF plugin is there. |
237 // We only care about: PageUp, PageDown, Left, Up, Right, Down. | 237 // We only care about: PageUp, PageDown, Left, Up, Right, Down. |
238 // If the user is holding a modifier key, ignore. | 238 // If the user is holding a modifier key, ignore. |
239 if (!this.plugin_ || | 239 if (!this.plugin_ || |
240 !arrayContains([33, 34, 37, 38, 39, 40], e.keyCode) || | 240 !arrayContains([33, 34, 37, 38, 39, 40], e.keyCode) || |
241 e.metaKey || e.altKey || e.shiftKey || e.ctrlKey) { | 241 e.metaKey || e.altKey || e.shiftKey || e.ctrlKey) { |
242 return; | 242 return; |
243 } | 243 } |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 new print_preview.Size(viewportWidth, viewportHeight)); | 734 new print_preview.Size(viewportWidth, viewportHeight)); |
735 } | 735 } |
736 } | 736 } |
737 }; | 737 }; |
738 | 738 |
739 // Export | 739 // Export |
740 return { | 740 return { |
741 PreviewArea: PreviewArea | 741 PreviewArea: PreviewArea |
742 }; | 742 }; |
743 }); | 743 }); |
OLD | NEW |