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'); |
not at google - send to devlin
2014/11/24 18:18:02
Could you make these changes to pdf in a separate
raymes
2014/11/25 13:34:10
Done.
| |
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 window.parent.postMessage(message, '*'); | 574 window.parent.postMessage(message, '*'); |
575 }, | 575 }, |
576 | 576 |
577 /** | 577 /** |
578 * @type {Viewport} the viewport of the PDF viewer. | 578 * @type {Viewport} the viewport of the PDF viewer. |
579 */ | 579 */ |
580 get viewport() { | 580 get viewport() { |
581 return this.viewport_; | 581 return this.viewport_; |
582 } | 582 } |
583 }; | 583 }; |
OLD | NEW |