| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 * @private | 143 * @private |
| 144 */ | 144 */ |
| 145 PreviewArea.Classes_ = { | 145 PreviewArea.Classes_ = { |
| 146 COMPATIBILITY_OBJECT: 'preview-area-compatibility-object', | 146 COMPATIBILITY_OBJECT: 'preview-area-compatibility-object', |
| 147 CUSTOM_MESSAGE_TEXT: 'preview-area-custom-message-text', | 147 CUSTOM_MESSAGE_TEXT: 'preview-area-custom-message-text', |
| 148 MESSAGE: 'preview-area-message', | 148 MESSAGE: 'preview-area-message', |
| 149 INVISIBLE: 'invisible', | 149 INVISIBLE: 'invisible', |
| 150 OPEN_SYSTEM_DIALOG_BUTTON: 'preview-area-open-system-dialog-button', | 150 OPEN_SYSTEM_DIALOG_BUTTON: 'preview-area-open-system-dialog-button', |
| 151 OPEN_SYSTEM_DIALOG_BUTTON_THROBBER: | 151 OPEN_SYSTEM_DIALOG_BUTTON_THROBBER: |
| 152 'preview-area-open-system-dialog-button-throbber', | 152 'preview-area-open-system-dialog-button-throbber', |
| 153 OVERLAY: 'preview-area-overlay-layer', | 153 OVERLAY: 'preview-area-overlay-layer' |
| 154 PDF_PLUGIN: 'preview-area-pdf-plugin' | |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 /** | 156 /** |
| 158 * Enumeration of IDs shown in the preview area. | 157 * Enumeration of IDs shown in the preview area. |
| 159 * @enum {string} | 158 * @enum {string} |
| 160 * @private | 159 * @private |
| 161 */ | 160 */ |
| 162 PreviewArea.MessageId_ = { | 161 PreviewArea.MessageId_ = { |
| 163 CUSTOM: 'custom', | 162 CUSTOM: 'custom', |
| 164 LOADING: 'loading', | 163 LOADING: 'loading', |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 this.plugin_ = document.createElement('embed'); | 410 this.plugin_ = document.createElement('embed'); |
| 412 // NOTE: The plugin's 'id' field must be set to 'pdf-viewer' since | 411 // NOTE: The plugin's 'id' field must be set to 'pdf-viewer' since |
| 413 // chrome/renderer/print_web_view_helper.cc actually references it. | 412 // chrome/renderer/print_web_view_helper.cc actually references it. |
| 414 this.plugin_.setAttribute('id', 'pdf-viewer'); | 413 this.plugin_.setAttribute('id', 'pdf-viewer'); |
| 415 this.plugin_.setAttribute('class', 'preview-area-plugin'); | 414 this.plugin_.setAttribute('class', 'preview-area-plugin'); |
| 416 this.plugin_.setAttribute( | 415 this.plugin_.setAttribute( |
| 417 'type', 'application/x-google-chrome-print-preview-pdf'); | 416 'type', 'application/x-google-chrome-print-preview-pdf'); |
| 418 this.plugin_.setAttribute('src', srcUrl); | 417 this.plugin_.setAttribute('src', srcUrl); |
| 419 this.plugin_.setAttribute('aria-live', 'polite'); | 418 this.plugin_.setAttribute('aria-live', 'polite'); |
| 420 this.plugin_.setAttribute('aria-atomic', 'true'); | 419 this.plugin_.setAttribute('aria-atomic', 'true'); |
| 421 this.getElement().appendChild(this.plugin_); | 420 this.getChildElement('.preview-area-plugin-wrapper'). |
| 421 appendChild(this.plugin_); |
| 422 | 422 |
| 423 global['onPreviewPluginLoad'] = this.onPluginLoad_.bind(this); | 423 global['onPreviewPluginLoad'] = this.onPluginLoad_.bind(this); |
| 424 this.plugin_.onload('onPreviewPluginLoad()'); | 424 this.plugin_.onload('onPreviewPluginLoad()'); |
| 425 | 425 |
| 426 global['onPreviewPluginVisualStateChange'] = | 426 global['onPreviewPluginVisualStateChange'] = |
| 427 this.onPreviewVisualStateChange_.bind(this); | 427 this.onPreviewVisualStateChange_.bind(this); |
| 428 this.plugin_.onScroll('onPreviewPluginVisualStateChange()'); | 428 this.plugin_.onScroll('onPreviewPluginVisualStateChange()'); |
| 429 this.plugin_.onPluginSizeChanged('onPreviewPluginVisualStateChange()'); | 429 this.plugin_.onPluginSizeChanged('onPreviewPluginVisualStateChange()'); |
| 430 | 430 |
| 431 this.plugin_.removePrintButton(); | 431 this.plugin_.removePrintButton(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 pluginWidth - this.plugin_.getVerticalScrollbarThickness(), | 587 pluginWidth - this.plugin_.getVerticalScrollbarThickness(), |
| 588 pluginHeight - this.plugin_.getHorizontalScrollbarThickness())); | 588 pluginHeight - this.plugin_.getHorizontalScrollbarThickness())); |
| 589 } | 589 } |
| 590 }; | 590 }; |
| 591 | 591 |
| 592 // Export | 592 // Export |
| 593 return { | 593 return { |
| 594 PreviewArea: PreviewArea | 594 PreviewArea: PreviewArea |
| 595 }; | 595 }; |
| 596 }); | 596 }); |
| OLD | NEW |