| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 this.sizer_, | 53 this.sizer_, |
| 54 this.viewportChanged_.bind(this), | 54 this.viewportChanged_.bind(this), |
| 55 this.beforeZoom_.bind(this), | 55 this.beforeZoom_.bind(this), |
| 56 this.afterZoom_.bind(this), | 56 this.afterZoom_.bind(this), |
| 57 getScrollbarWidth()); | 57 getScrollbarWidth()); |
| 58 | 58 |
| 59 // Create the plugin object dynamically so we can set its src. The plugin | 59 // Create the plugin object dynamically so we can set its src. The plugin |
| 60 // element is sized to fill the entire window and is set to be fixed | 60 // element is sized to fill the entire window and is set to be fixed |
| 61 // positioning, acting as a viewport. The plugin renders into this viewport | 61 // positioning, acting as a viewport. The plugin renders into this viewport |
| 62 // according to the scroll position of the window. | 62 // according to the scroll position of the window. |
| 63 this.plugin_ = document.createElement('object'); | 63 this.plugin_ = document.createElement('embed'); |
| 64 // NOTE: The plugin's 'id' field must be set to 'plugin' since | 64 // NOTE: The plugin's 'id' field must be set to 'plugin' since |
| 65 // chrome/renderer/printing/print_web_view_helper.cc actually references it. | 65 // chrome/renderer/printing/print_web_view_helper.cc actually references it. |
| 66 this.plugin_.id = 'plugin'; | 66 this.plugin_.id = 'plugin'; |
| 67 this.plugin_.type = 'application/x-google-chrome-pdf'; | 67 this.plugin_.type = 'application/x-google-chrome-pdf'; |
| 68 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this), | 68 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this), |
| 69 false); | 69 false); |
| 70 | 70 |
| 71 // Handle scripting messages from outside the extension that wish to interact | 71 // Handle scripting messages from outside the extension that wish to interact |
| 72 // with it. We also send a message indicating that extension has loaded and | 72 // with it. We also send a message indicating that extension has loaded and |
| 73 // is ready to receive messages. | 73 // is ready to receive messages. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 this.streamDetails.tabId != -1); | 585 this.streamDetails.tabId != -1); |
| 586 }, | 586 }, |
| 587 | 587 |
| 588 /** | 588 /** |
| 589 * @type {Viewport} the viewport of the PDF viewer. | 589 * @type {Viewport} the viewport of the PDF viewer. |
| 590 */ | 590 */ |
| 591 get viewport() { | 591 get viewport() { |
| 592 return this.viewport_; | 592 return this.viewport_; |
| 593 } | 593 } |
| 594 }; | 594 }; |
| OLD | NEW |