| 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 // TODO(rltoscano): Might be a problem where might be in fetching destinations | |
| 6 // state, then to file selection state, then cancel, which results in the | |
| 7 // fetching destinations state being lost. | |
| 8 | |
| 9 // TODO(rltoscano): Move data/* into print_preview.data namespace | 5 // TODO(rltoscano): Move data/* into print_preview.data namespace |
| 10 | 6 |
| 11 // TODO(rltoscano): Handle case where cloud print is initial destination, but | 7 var localStrings = new LocalStrings(templateData); |
| 12 // cloud print is not enabled. | |
| 13 | |
| 14 var localStrings = new LocalStrings(); | |
| 15 | 8 |
| 16 <include src="component.js"/> | 9 <include src="component.js"/> |
| 17 | 10 |
| 18 cr.define('print_preview', function() { | 11 cr.define('print_preview', function() { |
| 19 'use strict'; | 12 'use strict'; |
| 20 | 13 |
| 21 /** | 14 /** |
| 22 * Container class for Chromium's print preview. | 15 * Container class for Chromium's print preview. |
| 23 * @constructor | 16 * @constructor |
| 24 * @extends {print_preview.Component} | 17 * @extends {print_preview.Component} |
| 25 */ | 18 */ |
| 26 function PrintPreview() { | 19 function PrintPreview() { |
| 27 print_preview.Component.call(this); | 20 print_preview.Component.call(this); |
| 28 | 21 |
| 29 /** | 22 /** |
| 30 * Used to communicate with Chromium's print system. | 23 * Used to communicate with Chromium's print system. |
| 31 * @type {!print_preview.NativeLayer} | 24 * @type {!print_preview.NativeLayer} |
| 32 * @private | 25 * @private |
| 33 */ | 26 */ |
| 34 this.nativeLayer_ = new print_preview.NativeLayer(); | 27 this.nativeLayer_ = new print_preview.NativeLayer(); |
| 35 | 28 |
| 36 /** | 29 /** |
| 30 * Event target that contains information about the logged in user. |
| 31 * @type {!print_preview.UserInfo} |
| 32 * @private |
| 33 */ |
| 34 this.userInfo_ = new print_preview.UserInfo(); |
| 35 |
| 36 /** |
| 37 * Data store which holds print destinations. | 37 * Data store which holds print destinations. |
| 38 * @type {!print_preview.DestinationStore} | 38 * @type {!print_preview.DestinationStore} |
| 39 * @private | 39 * @private |
| 40 */ | 40 */ |
| 41 this.destinationStore_ = new print_preview.DestinationStore(); | 41 this.destinationStore_ = new print_preview.DestinationStore( |
| 42 this.nativeLayer_); |
| 42 | 43 |
| 43 /** | 44 /** |
| 44 * Storage of the print ticket used to create the print job. | 45 * Storage of the print ticket used to create the print job. |
| 45 * @type {!print_preview.PrintTicketStore} | 46 * @type {!print_preview.PrintTicketStore} |
| 46 * @private | 47 * @private |
| 47 */ | 48 */ |
| 48 this.printTicketStore_ = new print_preview.PrintTicketStore( | 49 this.printTicketStore_ = new print_preview.PrintTicketStore( |
| 49 this.destinationStore_); | 50 this.destinationStore_); |
| 50 | 51 |
| 51 /** | 52 /** |
| 52 * Holds the print and cancel buttons and renders some document statistics. | 53 * Holds the print and cancel buttons and renders some document statistics. |
| 53 * @type {!print_preview.PrintHeader} | 54 * @type {!print_preview.PrintHeader} |
| 54 * @private | 55 * @private |
| 55 */ | 56 */ |
| 56 this.printHeader_ = new print_preview.PrintHeader( | 57 this.printHeader_ = new print_preview.PrintHeader( |
| 57 this.printTicketStore_, this.destinationStore_); | 58 this.printTicketStore_, this.destinationStore_); |
| 58 this.addChild(this.printHeader_); | 59 this.addChild(this.printHeader_); |
| 59 | 60 |
| 60 /** | 61 /** |
| 62 * Component used to search for print destinations. |
| 63 * @type {!print_preview.DestinationSearch} |
| 64 * @private |
| 65 */ |
| 66 this.destinationSearch_ = new print_preview.DestinationSearch( |
| 67 this.destinationStore_, this.userInfo_); |
| 68 this.addChild(this.destinationSearch_); |
| 69 |
| 70 /** |
| 61 * Component that renders the print destination. | 71 * Component that renders the print destination. |
| 62 * @type {!print_preview.DestinationSettings} | 72 * @type {!print_preview.DestinationSettings} |
| 63 * @private | 73 * @private |
| 64 */ | 74 */ |
| 65 this.destinationSettings_ = new print_preview.DestinationSettings( | 75 this.destinationSettings_ = new print_preview.DestinationSettings( |
| 66 this.destinationStore_); | 76 this.destinationStore_); |
| 67 this.addChild(this.destinationSettings_); | 77 this.addChild(this.destinationSettings_); |
| 68 | 78 |
| 69 /** | 79 /** |
| 70 * Component that renders UI for entering in page range. | 80 * Component that renders UI for entering in page range. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 this.isInKioskAutoPrintMode_ = false; | 157 this.isInKioskAutoPrintMode_ = false; |
| 148 | 158 |
| 149 /** | 159 /** |
| 150 * State of the print preview UI. | 160 * State of the print preview UI. |
| 151 * @type {print_preview.PrintPreview.UiState_} | 161 * @type {print_preview.PrintPreview.UiState_} |
| 152 * @private | 162 * @private |
| 153 */ | 163 */ |
| 154 this.uiState_ = PrintPreview.UiState_.INITIALIZING; | 164 this.uiState_ = PrintPreview.UiState_.INITIALIZING; |
| 155 | 165 |
| 156 /** | 166 /** |
| 157 * Current state of fetching destinations. | |
| 158 * @type {print_preview.PrintPreview.FetchState_} | |
| 159 * @private | |
| 160 */ | |
| 161 this.fetchState_ = PrintPreview.FetchState_.READY; | |
| 162 | |
| 163 /** | |
| 164 * Whether document preview generation is in progress. | 167 * Whether document preview generation is in progress. |
| 165 * @type {boolean} | 168 * @type {boolean} |
| 166 * @private | 169 * @private |
| 167 */ | 170 */ |
| 168 this.isPreviewGenerationInProgress_ = true; | 171 this.isPreviewGenerationInProgress_ = true; |
| 169 | |
| 170 this.tracker.add(window, 'DOMContentLoaded', this.onWindowLoad_.bind(this)); | |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 /** | 174 /** |
| 174 * States of the print preview. | 175 * States of the print preview. |
| 175 * @enum {string} | 176 * @enum {string} |
| 176 * @private | 177 * @private |
| 177 */ | 178 */ |
| 178 PrintPreview.UiState_ = { | 179 PrintPreview.UiState_ = { |
| 179 INITIALIZING: 'initializing', | 180 INITIALIZING: 'initializing', |
| 180 READY: 'ready', | 181 READY: 'ready', |
| 181 OPENING_PDF_PREVIEW: 'opening-pdf-preview', | 182 OPENING_PDF_PREVIEW: 'opening-pdf-preview', |
| 182 OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog', | 183 OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog', |
| 183 PRINTING: 'printing', | 184 PRINTING: 'printing', |
| 184 FILE_SELECTION: 'file-selection', | 185 FILE_SELECTION: 'file-selection', |
| 185 CLOSING: 'closing', | 186 CLOSING: 'closing', |
| 186 ERROR: 'error' | 187 ERROR: 'error' |
| 187 }; | 188 }; |
| 188 | 189 |
| 189 /** | |
| 190 * Bitfield of the states of fetching destinations. | |
| 191 * @enum {number} | |
| 192 * @private | |
| 193 */ | |
| 194 PrintPreview.FetchState_ = { | |
| 195 READY: 1, | |
| 196 LOCAL_DESTINATIONS: 2, | |
| 197 RECENT_CLOUD_DESTINATIONS: 4, | |
| 198 ALL_CLOUD_DESTINATIONS: 8 | |
| 199 }; | |
| 200 | |
| 201 PrintPreview.prototype = { | 190 PrintPreview.prototype = { |
| 202 __proto__: print_preview.Component.prototype, | 191 __proto__: print_preview.Component.prototype, |
| 203 | 192 |
| 204 /** @override */ | 193 /** Sets up the page and print preview by getting the printer list. */ |
| 205 decorateInternal: function() { | 194 initialize: function() { |
| 206 this.printHeader_.decorate($('print-header')); | 195 this.decorate($('print-preview')); |
| 207 this.destinationSettings_.decorate($('destination-settings')); | 196 i18nTemplate.process(document, templateData); |
| 208 this.pageSettings_.decorate($('page-settings')); | 197 if (!this.previewArea_.hasCompatiblePlugin) { |
| 209 this.copiesSettings_.decorate($('copies-settings')); | 198 this.setIsEnabled_(false); |
| 210 this.layoutSettings_.decorate($('layout-settings')); | 199 } |
| 211 this.colorSettings_.decorate($('color-settings')); | 200 this.nativeLayer_.startGetInitialSettings(); |
| 212 this.marginSettings_.decorate($('margin-settings')); | 201 this.destinationStore_.startLoadLocalDestinations(); |
| 213 this.otherOptionsSettings_.decorate($('other-options-settings')); | |
| 214 this.previewArea_.decorate($('preview-area')); | |
| 215 | |
| 216 setIsVisible($('cloud-print-dialog-link'), cr.isChromeOS); | |
| 217 setIsVisible($('system-dialog-link'), !cr.isChromeOS); | |
| 218 setIsVisible($('open-pdf-in-preview-link'), cr.isMac); | |
| 219 }, | 202 }, |
| 220 | 203 |
| 221 /** @override */ | 204 /** @override */ |
| 222 enterDocument: function() { | 205 enterDocument: function() { |
| 223 // Native layer events. | 206 // Native layer events. |
| 224 this.tracker.add( | 207 this.tracker.add( |
| 225 this.nativeLayer_, | 208 this.nativeLayer_, |
| 226 print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET, | 209 print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET, |
| 227 this.onInitialSettingsSet_.bind(this)); | 210 this.onInitialSettingsSet_.bind(this)); |
| 228 this.tracker.add( | 211 this.tracker.add( |
| 229 this.nativeLayer_, | 212 this.nativeLayer_, |
| 230 print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE, | 213 print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE, |
| 231 this.onCloudPrintEnable_.bind(this)); | 214 this.onCloudPrintEnable_.bind(this)); |
| 232 this.tracker.add( | 215 this.tracker.add( |
| 233 this.nativeLayer_, | 216 this.nativeLayer_, |
| 234 print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET, | |
| 235 this.onLocalDestinationsSet_.bind(this)); | |
| 236 this.tracker.add( | |
| 237 this.nativeLayer_, | |
| 238 print_preview.NativeLayer.EventType.CAPABILITIES_SET, | |
| 239 this.onLocalDestinationCapabilitiesSet_.bind(this)); | |
| 240 this.tracker.add( | |
| 241 this.nativeLayer_, | |
| 242 print_preview.NativeLayer.EventType.DESTINATIONS_RELOAD, | |
| 243 this.onDestinationsReload_.bind(this)); | |
| 244 this.tracker.add( | |
| 245 this.nativeLayer_, | |
| 246 print_preview.NativeLayer.EventType.PRINT_TO_CLOUD, | 217 print_preview.NativeLayer.EventType.PRINT_TO_CLOUD, |
| 247 this.onPrintToCloud_.bind(this)); | 218 this.onPrintToCloud_.bind(this)); |
| 248 this.tracker.add( | 219 this.tracker.add( |
| 249 this.nativeLayer_, | 220 this.nativeLayer_, |
| 250 print_preview.NativeLayer.EventType.FILE_SELECTION_CANCEL, | 221 print_preview.NativeLayer.EventType.FILE_SELECTION_CANCEL, |
| 251 this.onFileSelectionCancel_.bind(this)); | 222 this.onFileSelectionCancel_.bind(this)); |
| 252 this.tracker.add( | 223 this.tracker.add( |
| 253 this.nativeLayer_, | 224 this.nativeLayer_, |
| 254 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, | 225 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, |
| 255 this.onFileSelectionComplete_.bind(this)); | 226 this.onFileSelectionComplete_.bind(this)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 this.previewArea_, | 258 this.previewArea_, |
| 288 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, | 259 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, |
| 289 this.onPreviewGenerationFail_.bind(this)); | 260 this.onPreviewGenerationFail_.bind(this)); |
| 290 this.tracker.add( | 261 this.tracker.add( |
| 291 this.previewArea_, | 262 this.previewArea_, |
| 292 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, | 263 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, |
| 293 this.openSystemPrintDialog_.bind(this)); | 264 this.openSystemPrintDialog_.bind(this)); |
| 294 | 265 |
| 295 this.tracker.add( | 266 this.tracker.add( |
| 296 this.destinationStore_, | 267 this.destinationStore_, |
| 297 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 268 print_preview.DestinationStore.EventType. |
| 298 this.onDestinationSelect_.bind(this)); | 269 SELECTED_DESTINATION_CAPABILITIES_READY, |
| 270 this.printIfReady_.bind(this)); |
| 299 | 271 |
| 300 this.tracker.add( | 272 this.tracker.add( |
| 301 this.printHeader_, | 273 this.printHeader_, |
| 302 print_preview.PrintHeader.EventType.PRINT_BUTTON_CLICK, | 274 print_preview.PrintHeader.EventType.PRINT_BUTTON_CLICK, |
| 303 this.onPrintButtonClick_.bind(this)); | 275 this.onPrintButtonClick_.bind(this)); |
| 304 this.tracker.add( | 276 this.tracker.add( |
| 305 this.printHeader_, | 277 this.printHeader_, |
| 306 print_preview.PrintHeader.EventType.CANCEL_BUTTON_CLICK, | 278 print_preview.PrintHeader.EventType.CANCEL_BUTTON_CLICK, |
| 307 this.onCancelButtonClick_.bind(this)); | 279 this.onCancelButtonClick_.bind(this)); |
| 308 | 280 |
| 281 this.tracker.add(window, 'keydown', this.onKeyDown_.bind(this)); |
| 282 |
| 309 this.tracker.add( | 283 this.tracker.add( |
| 310 this.destinationSettings_, | 284 this.destinationSettings_, |
| 311 print_preview.DestinationSettings.EventType.MANAGE_PRINTERS_SELECT, | 285 print_preview.DestinationSettings.EventType.CHANGE_BUTTON_ACTIVATE, |
| 312 this.onManagePrinters_.bind(this)); | 286 this.onDestinationChangeButtonActivate_.bind(this)); |
| 313 | 287 |
| 314 this.tracker.add(window, 'keydown', this.onKeyDown_.bind(this)); | 288 this.tracker.add( |
| 289 this.destinationSearch_, |
| 290 print_preview.DestinationSearch.EventType.MANAGE_CLOUD_DESTINATIONS, |
| 291 this.onManageCloudDestinationsActivated_.bind(this)); |
| 292 this.tracker.add( |
| 293 this.destinationSearch_, |
| 294 print_preview.DestinationSearch.EventType.MANAGE_LOCAL_DESTINATIONS, |
| 295 this.onManageLocalDestinationsActivated_.bind(this)); |
| 296 this.tracker.add( |
| 297 this.destinationSearch_, |
| 298 print_preview.DestinationSearch.EventType.SIGN_IN, |
| 299 this.onCloudPrintSignInActivated_.bind(this)); |
| 300 }, |
| 301 |
| 302 /** @override */ |
| 303 decorateInternal: function() { |
| 304 this.printHeader_.decorate($('print-header')); |
| 305 this.destinationSearch_.decorate($('destination-search')); |
| 306 this.destinationSettings_.decorate($('destination-settings')); |
| 307 this.pageSettings_.decorate($('page-settings')); |
| 308 this.copiesSettings_.decorate($('copies-settings')); |
| 309 this.layoutSettings_.decorate($('layout-settings')); |
| 310 this.colorSettings_.decorate($('color-settings')); |
| 311 this.marginSettings_.decorate($('margin-settings')); |
| 312 this.otherOptionsSettings_.decorate($('other-options-settings')); |
| 313 this.previewArea_.decorate($('preview-area')); |
| 314 |
| 315 setIsVisible($('cloud-print-dialog-link'), cr.isChromeOS); |
| 316 setIsVisible($('system-dialog-link'), !cr.isChromeOS); |
| 317 setIsVisible($('open-pdf-in-preview-link'), cr.isMac); |
| 315 }, | 318 }, |
| 316 | 319 |
| 317 /** | 320 /** |
| 318 * Sets whether the controls in the print preview are enabled. | 321 * Sets whether the controls in the print preview are enabled. |
| 319 * @param {boolean} isEnabled Whether the controls in the print preview are | 322 * @param {boolean} isEnabled Whether the controls in the print preview are |
| 320 * enabled. | 323 * enabled. |
| 321 * @private | 324 * @private |
| 322 */ | 325 */ |
| 323 setIsEnabled_: function(isEnabled) { | 326 setIsEnabled_: function(isEnabled) { |
| 324 $('system-dialog-link').disabled = !isEnabled; | 327 $('system-dialog-link').disabled = !isEnabled; |
| 325 $('cloud-print-dialog-link').disabled = !isEnabled; | 328 $('cloud-print-dialog-link').disabled = !isEnabled; |
| 326 $('open-pdf-in-preview-link').disabled = !isEnabled; | 329 $('open-pdf-in-preview-link').disabled = !isEnabled; |
| 327 this.printHeader_.isEnabled = isEnabled; | 330 this.printHeader_.isEnabled = isEnabled; |
| 328 this.destinationSettings_.isEnabled = isEnabled; | 331 this.destinationSettings_.isEnabled = isEnabled; |
| 329 this.pageSettings_.isEnabled = isEnabled; | 332 this.pageSettings_.isEnabled = isEnabled; |
| 330 this.copiesSettings_.isEnabled = isEnabled; | 333 this.copiesSettings_.isEnabled = isEnabled; |
| 331 this.layoutSettings_.isEnabled = isEnabled; | 334 this.layoutSettings_.isEnabled = isEnabled; |
| 332 this.colorSettings_.isEnabled = isEnabled; | 335 this.colorSettings_.isEnabled = isEnabled; |
| 333 this.marginSettings_.isEnabled = isEnabled; | 336 this.marginSettings_.isEnabled = isEnabled; |
| 334 this.otherOptionsSettings_.isEnabled = isEnabled; | 337 this.otherOptionsSettings_.isEnabled = isEnabled; |
| 335 }, | 338 }, |
| 336 | 339 |
| 337 /** | 340 /** |
| 338 * Creates a local PDF print destination. | |
| 339 * @return {!print_preview.Destination} Created print destination. | |
| 340 * @private | |
| 341 */ | |
| 342 createLocalPdfPrintDestination_: function() { | |
| 343 var dest = new print_preview.Destination( | |
| 344 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, | |
| 345 localStrings.getString('printToPDF'), | |
| 346 false /*isRecent*/, | |
| 347 true /*isLocal*/); | |
| 348 dest.capabilities = new print_preview.ChromiumCapabilities( | |
| 349 false /*hasCopiesCapability*/, | |
| 350 '1' /*defaultCopiesStr*/, | |
| 351 false /*hasCollateCapability*/, | |
| 352 false /*defaultIsCollateEnabled*/, | |
| 353 false /*hasDuplexCapability*/, | |
| 354 false /*defaultIsDuplexEnabled*/, | |
| 355 true /*hasOrientationCapability*/, | |
| 356 false /*defaultIsLandscapeEnabled*/, | |
| 357 true /*hasColorCapability*/, | |
| 358 true /*defaultIsColorEnabled*/); | |
| 359 return dest; | |
| 360 }, | |
| 361 | |
| 362 /** | |
| 363 * Creates a new "Print with Cloud Print" print destination. NOTE: this | |
| 364 * destination will appear as "Search for additional printers..." on | |
| 365 * Chrome OS. | |
| 366 * @return {!print_preview.Destination} Created print destination. | |
| 367 * @private | |
| 368 */ | |
| 369 createPrintWithCloudPrintDestination_: function() { | |
| 370 var dest = new print_preview.Destination( | |
| 371 print_preview.Destination.GooglePromotedId.PRINT_WITH_CLOUD_PRINT, | |
| 372 localStrings.getString('printWithCloudPrint'), | |
| 373 false /*isRecent*/, | |
| 374 false /*isLocal*/); | |
| 375 dest.capabilities = new print_preview.ChromiumCapabilities( | |
| 376 false /*hasCopiesCapability*/, | |
| 377 '1' /*defaultCopiesStr*/, | |
| 378 false /*hasCollateCapability*/, | |
| 379 false /*defaultIsCollateEnabled*/, | |
| 380 false /*hasDuplexCapability*/, | |
| 381 false /*defaultIsDuplexEnabled*/, | |
| 382 true /*hasOrientationCapability*/, | |
| 383 false /*defaultIsLandscapeEnabled*/, | |
| 384 true /*hasColorCapability*/, | |
| 385 true /*defaultIsColorEnabled*/); | |
| 386 return dest; | |
| 387 }, | |
| 388 | |
| 389 /** | |
| 390 * Prints the document or launches a pdf preview on the local system. | 341 * Prints the document or launches a pdf preview on the local system. |
| 391 * @param {boolean} isPdfPreview Whether to launch the pdf preview. | 342 * @param {boolean} isPdfPreview Whether to launch the pdf preview. |
| 392 * @private | 343 * @private |
| 393 */ | 344 */ |
| 394 printDocumentOrOpenPdfPreview_: function(isPdfPreview) { | 345 printDocumentOrOpenPdfPreview_: function(isPdfPreview) { |
| 395 assert(this.uiState_ == PrintPreview.UiState_.READY, | 346 assert(this.uiState_ == PrintPreview.UiState_.READY, |
| 396 'Print document request received when not in ready state: ' + | 347 'Print document request received when not in ready state: ' + |
| 397 this.uiState_); | 348 this.uiState_); |
| 398 if (isPdfPreview) { | 349 if (isPdfPreview) { |
| 399 this.uiState_ = PrintPreview.UiState_.OPENING_PDF_PREVIEW; | 350 this.uiState_ = PrintPreview.UiState_.OPENING_PDF_PREVIEW; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 openSystemPrintDialog_: function() { | 412 openSystemPrintDialog_: function() { |
| 462 assert(this.uiState_ == PrintPreview.UiState_.READY, | 413 assert(this.uiState_ == PrintPreview.UiState_.READY, |
| 463 'Opening system dialog when not in ready state: ' + this.uiState_); | 414 'Opening system dialog when not in ready state: ' + this.uiState_); |
| 464 setIsVisible($('dialog-throbber'), true); | 415 setIsVisible($('dialog-throbber'), true); |
| 465 this.setIsEnabled_(false); | 416 this.setIsEnabled_(false); |
| 466 this.uiState_ = PrintPreview.UiState_.OPENING_NATIVE_PRINT_DIALOG; | 417 this.uiState_ = PrintPreview.UiState_.OPENING_NATIVE_PRINT_DIALOG; |
| 467 this.nativeLayer_.startShowSystemDialog(); | 418 this.nativeLayer_.startShowSystemDialog(); |
| 468 }, | 419 }, |
| 469 | 420 |
| 470 /** | 421 /** |
| 471 * Window onload handler, sets up the page and starts print preview by | |
| 472 * getting the printer list. | |
| 473 * @private | |
| 474 */ | |
| 475 onWindowLoad_: function() { | |
| 476 this.decorate($('print-preview')); | |
| 477 i18nTemplate.process(document, templateData); | |
| 478 if (!this.previewArea_.hasCompatiblePlugin) { | |
| 479 this.setIsEnabled_(false); | |
| 480 } | |
| 481 this.nativeLayer_.startGetInitialSettings(); | |
| 482 this.nativeLayer_.startGetLocalDestinations(); | |
| 483 }, | |
| 484 | |
| 485 /** | |
| 486 * Called when the native layer has initial settings to set. Sets the | 422 * Called when the native layer has initial settings to set. Sets the |
| 487 * initial settings of the print preview and begins fetching print | 423 * initial settings of the print preview and begins fetching print |
| 488 * destinations. | 424 * destinations. |
| 489 * @param {cr.Event} event Contains the initial print preview settings | 425 * @param {cr.Event} event Contains the initial print preview settings |
| 490 * persisted through the session. | 426 * persisted through the session. |
| 491 * @private | 427 * @private |
| 492 */ | 428 */ |
| 493 onInitialSettingsSet_: function(event) { | 429 onInitialSettingsSet_: function(event) { |
| 494 assert(this.uiState_ == PrintPreview.UiState_.INITIALIZING, | 430 assert(this.uiState_ == PrintPreview.UiState_.INITIALIZING, |
| 495 'Updating initial settings when not in initializing state: ' + | 431 'Updating initial settings when not in initializing state: ' + |
| (...skipping 16 matching lines...) Expand all Loading... |
| 512 }, | 448 }, |
| 513 | 449 |
| 514 /** | 450 /** |
| 515 * Calls when the native layer enables Google Cloud Print integration. | 451 * Calls when the native layer enables Google Cloud Print integration. |
| 516 * Fetches the user's cloud printers. | 452 * Fetches the user's cloud printers. |
| 517 * @param {cr.Event} event Contains the base URL of the Google Cloud Print | 453 * @param {cr.Event} event Contains the base URL of the Google Cloud Print |
| 518 * service. | 454 * service. |
| 519 * @private | 455 * @private |
| 520 */ | 456 */ |
| 521 onCloudPrintEnable_: function(event) { | 457 onCloudPrintEnable_: function(event) { |
| 522 this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface( | 458 this.cloudPrintInterface_ = |
| 523 event.baseCloudPrintUrl); | 459 new cloudprint.CloudPrintInterface(event.baseCloudPrintUrl); |
| 524 this.tracker.add( | |
| 525 this.cloudPrintInterface_, | |
| 526 cloudprint.CloudPrintInterface.EventType.SEARCH_DONE, | |
| 527 this.onCloudPrintSearchDone_.bind(this)); | |
| 528 this.tracker.add( | |
| 529 this.cloudPrintInterface_, | |
| 530 cloudprint.CloudPrintInterface.EventType.PRINTER_DONE, | |
| 531 this.onCloudPrintPrinterDone_.bind(this)); | |
| 532 this.tracker.add( | 460 this.tracker.add( |
| 533 this.cloudPrintInterface_, | 461 this.cloudPrintInterface_, |
| 534 cloudprint.CloudPrintInterface.EventType.SUBMIT_DONE, | 462 cloudprint.CloudPrintInterface.EventType.SUBMIT_DONE, |
| 535 this.onCloudPrintSubmitDone_.bind(this)); | 463 this.onCloudPrintSubmitDone_.bind(this)); |
| 536 this.tracker.add( | 464 this.tracker.add( |
| 537 this.cloudPrintInterface_, | 465 this.cloudPrintInterface_, |
| 538 cloudprint.CloudPrintInterface.EventType.ERROR, | 466 cloudprint.CloudPrintInterface.EventType.ERROR, |
| 539 this.onCloudPrintError_.bind(this)); | 467 this.onCloudPrintError_.bind(this)); |
| 540 | 468 |
| 541 var printWithCloudPrintDest = | 469 this.userInfo_.setCloudPrintInterface(this.cloudPrintInterface_); |
| 542 this.createPrintWithCloudPrintDestination_(); | 470 this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_); |
| 543 this.destinationStore_.insertDestination(printWithCloudPrintDest); | 471 this.destinationStore_.startLoadRecentCloudDestinations(); |
| 544 | |
| 545 if (cr.isChromeOS) { | |
| 546 this.cloudPrintInterface_.search(true /*isRecent*/); | |
| 547 this.fetchState_ |= PrintPreview.FetchState_.RECENT_CLOUD_DESTINATIONS; | |
| 548 } | |
| 549 }, | 472 }, |
| 550 | 473 |
| 551 /** | 474 /** |
| 552 * Called when the native layer gets local destinations. Adds local | |
| 553 * destination objects received from the operating system to the destination | |
| 554 * store. Also adds a save-as-pdf printer. | |
| 555 * @param {cr.Event} Contains the local destinations to set. | |
| 556 * @private | |
| 557 */ | |
| 558 onLocalDestinationsSet_: function(event) { | |
| 559 var localDestinations = []; | |
| 560 for (var destInfo, i = 0; destInfo = event.destinationInfos[i]; i++) { | |
| 561 localDestinations.push( | |
| 562 print_preview.LocalDestinationParser.parse(destInfo)); | |
| 563 } | |
| 564 localDestinations.push(this.createLocalPdfPrintDestination_()); | |
| 565 this.destinationStore_.insertDestinations(localDestinations); | |
| 566 this.fetchState_ &= ~PrintPreview.FetchState_.LOCAL_DESTINATIONS; | |
| 567 }, | |
| 568 | |
| 569 /** | |
| 570 * Called when the native layer retrieves the capabilities for the selected | |
| 571 * local destination. | |
| 572 * @param {cr.Event} event Contains the capabilities of the local print | |
| 573 * destination. | |
| 574 * @private | |
| 575 */ | |
| 576 onLocalDestinationCapabilitiesSet_: function(event) { | |
| 577 // TODO(rltoscano): There may be a race condition here. This method is | |
| 578 // assumed to return capabilities for the currently selected printer. But | |
| 579 // between the time the local printer was selected and the capabilities | |
| 580 // were retrieved, the selected printer can change. One way to address | |
| 581 // this is to include the destination ID in the settingsInfo parameter. | |
| 582 var selectedDestination = this.destinationStore_.selectedDestination; | |
| 583 if (selectedDestination.isLocal) { | |
| 584 var capabilities = print_preview.LocalCapabilitiesParser.parse( | |
| 585 event.settingsInfo); | |
| 586 selectedDestination.capabilities = capabilities; | |
| 587 this.printTicketStore_.updateDestinationCapabilities(capabilities); | |
| 588 this.printIfReady_(); | |
| 589 } | |
| 590 }, | |
| 591 | |
| 592 /** | |
| 593 * Called from native layer after the user was requested to sign in, and did | |
| 594 * so successfully. | |
| 595 * @private | |
| 596 */ | |
| 597 onDestinationsReload_: function() { | |
| 598 this.destinationStore_.clear(); | |
| 599 this.nativeLayer_.startGetLocalDestinations(); | |
| 600 if (this.cloudPrintInterface_) { | |
| 601 // Fetch recent printers. | |
| 602 this.cloudPrintInterface_.search(true /*isRecent*/); | |
| 603 // Fetch the full printer list. | |
| 604 this.cloudPrintInterface_.search(false /*isRecent*/); | |
| 605 } | |
| 606 this.fetchState_ = | |
| 607 PrintPreview.FetchState_.LOCAL_DESTINATIONS | | |
| 608 PrintPreview.FetchState_.ALL_CLOUD_DESTINATIONS | | |
| 609 PrintPreview.FetchState_.RECENT_CLOUD_DESTINATIONS; | |
| 610 }, | |
| 611 | |
| 612 /** | |
| 613 * Called from the native layer when ready to print to Google Cloud Print. | 475 * Called from the native layer when ready to print to Google Cloud Print. |
| 614 * @param {cr.Event} event Contains the body to send in the HTTP request. | 476 * @param {cr.Event} event Contains the body to send in the HTTP request. |
| 615 * @private | 477 * @private |
| 616 */ | 478 */ |
| 617 onPrintToCloud_: function(event) { | 479 onPrintToCloud_: function(event) { |
| 618 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, | 480 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, |
| 619 'Document ready to be sent to the cloud when not in printing ' + | 481 'Document ready to be sent to the cloud when not in printing ' + |
| 620 'state: ' + this.uiState_); | 482 'state: ' + this.uiState_); |
| 621 assert(this.cloudPrintInterface_ != null, | 483 assert(this.cloudPrintInterface_ != null, |
| 622 'Google Cloud Print is not enabled'); | 484 'Google Cloud Print is not enabled'); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 643 onFileSelectionComplete_: function() { | 505 onFileSelectionComplete_: function() { |
| 644 assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, | 506 assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, |
| 645 'File selection completed when not in file-selection state: ' + | 507 'File selection completed when not in file-selection state: ' + |
| 646 this.uiState_); | 508 this.uiState_); |
| 647 this.previewArea_.showCustomMessage( | 509 this.previewArea_.showCustomMessage( |
| 648 localStrings.getString('printingToPDFInProgress')); | 510 localStrings.getString('printingToPDFInProgress')); |
| 649 this.uiState_ = PrintPreview.UiState_.PRINTING; | 511 this.uiState_ = PrintPreview.UiState_.PRINTING; |
| 650 }, | 512 }, |
| 651 | 513 |
| 652 /** | 514 /** |
| 653 * Called when the Google Cloud Print search API call completes. Adds | |
| 654 * destinations to the printer store and selects one if it matches the | |
| 655 * initial destination. | |
| 656 * @param {cr.Event} event Contains the new cloud destinations. | |
| 657 * @private | |
| 658 */ | |
| 659 onCloudPrintSearchDone_: function(event) { | |
| 660 this.destinationStore_.insertDestinations(event.printers); | |
| 661 if (event.isRecent) { | |
| 662 this.fetchState_ &= ~PrintPreview.FetchState_.RECENT_CLOUD_DESTINATIONS; | |
| 663 } else { | |
| 664 this.fetchState_ &= ~PrintPreview.FetchState_.ALL_CLOUD_DESTINATIONS; | |
| 665 } | |
| 666 }, | |
| 667 | |
| 668 /** | |
| 669 * Called when the Google Cloud Print printer API call completes. Updates | |
| 670 * the UI with the newly received capabilities. | |
| 671 * @param {cr.Event} event Contains the destination returned in the printer | |
| 672 * API call. | |
| 673 */ | |
| 674 onCloudPrintPrinterDone_: function(event) { | |
| 675 var dest = this.destinationStore_.updateDestination(event.printer); | |
| 676 if (this.destinationStore_.selectedDestination == dest) { | |
| 677 this.printTicketStore_.updateDestinationCapabilities(dest.capabilities); | |
| 678 this.printIfReady_(); | |
| 679 } | |
| 680 }, | |
| 681 | |
| 682 /** | |
| 683 * Called after successfully submitting a job to Google Cloud Print. | 515 * Called after successfully submitting a job to Google Cloud Print. |
| 684 * @private | 516 * @private |
| 685 */ | 517 */ |
| 686 onCloudPrintSubmitDone_: function() { | 518 onCloudPrintSubmitDone_: function() { |
| 687 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, | 519 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, |
| 688 'Submited job to Google Cloud Print but not in printing state ' + | 520 'Submited job to Google Cloud Print but not in printing state ' + |
| 689 this.uiState_); | 521 this.uiState_); |
| 690 this.close_(); | 522 this.close_(); |
| 691 }, | 523 }, |
| 692 | 524 |
| 693 /** | 525 /** |
| 694 * Called when there was an error communicating with Google Cloud print. | 526 * Called when there was an error communicating with Google Cloud print. |
| 695 * Displays an error message in the print header. | 527 * Displays an error message in the print header. |
| 696 * @param {cr.Event} event Contains the error message. | 528 * @param {cr.Event} event Contains the error message. |
| 697 * @private | 529 * @private |
| 698 */ | 530 */ |
| 699 onCloudPrintError_: function(event) { | 531 onCloudPrintError_: function(event) { |
| 700 if (cr.isChromeOS && event.message == '403') { | 532 if (event.message == '403') { |
| 701 this.nativeLayer_.startCloudPrintSignIn(); | 533 this.destinationSearch_.showCloudPrintPromo(); |
| 702 } else { | 534 } else { |
| 703 this.printHeader_.setErrorMessage(event.message); | 535 this.printHeader_.setErrorMessage(event.message); |
| 704 } | 536 } |
| 705 this.fetchState_ &= | |
| 706 ~PrintPreview.FetchState_.RECENT_CLOUD_DESTINATIONS & | |
| 707 ~PrintPreview.FetchState_.ALL_CLOUD_DESTINATIONS; | |
| 708 }, | 537 }, |
| 709 | 538 |
| 710 /** | 539 /** |
| 711 * Called when a new destination has been selected. Fetches the | |
| 712 * destination's capability list. | |
| 713 * @private | |
| 714 */ | |
| 715 onDestinationSelect_: function() { | |
| 716 var destination = this.destinationStore_.selectedDestination; | |
| 717 | |
| 718 // Fetch destination capabilities if necessary. | |
| 719 if (!destination.capabilities) { | |
| 720 if (destination.isLocal) { | |
| 721 this.nativeLayer_.startGetLocalDestinationCapabilities( | |
| 722 destination.id); | |
| 723 } else { | |
| 724 assert(this.cloudPrintInterface_ != null, | |
| 725 'Selected destination is a cloud destination, but Google ' + | |
| 726 'Cloud Print is not enabled'); | |
| 727 this.cloudPrintInterface_.printer(destination.id); | |
| 728 } | |
| 729 } else { | |
| 730 this.printTicketStore_.updateDestinationCapabilities( | |
| 731 destination.capabilities); | |
| 732 } | |
| 733 | |
| 734 this.printIfReady_(); | |
| 735 }, | |
| 736 | |
| 737 /** | |
| 738 * Called when the preview area's preview generation is in progress. | 540 * Called when the preview area's preview generation is in progress. |
| 739 * @private | 541 * @private |
| 740 */ | 542 */ |
| 741 onPreviewGenerationInProgress_: function() { | 543 onPreviewGenerationInProgress_: function() { |
| 742 this.isPreviewGenerationInProgress_ = true; | 544 this.isPreviewGenerationInProgress_ = true; |
| 743 }, | 545 }, |
| 744 | 546 |
| 745 /** | 547 /** |
| 746 * Called when the preview area's preview generation is complete. | 548 * Called when the preview area's preview generation is complete. |
| 747 * @private | 549 * @private |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 /** | 602 /** |
| 801 * Consume escape key presses and ctrl + shift + p. Delegate everything else | 603 * Consume escape key presses and ctrl + shift + p. Delegate everything else |
| 802 * to the preview area. | 604 * to the preview area. |
| 803 * @param {KeyboardEvent} e The keyboard event. | 605 * @param {KeyboardEvent} e The keyboard event. |
| 804 * @private | 606 * @private |
| 805 */ | 607 */ |
| 806 onKeyDown_: function(e) { | 608 onKeyDown_: function(e) { |
| 807 // Escape key closes the dialog. | 609 // Escape key closes the dialog. |
| 808 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && | 610 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && |
| 809 !e.metaKey) { | 611 !e.metaKey) { |
| 810 this.close_(); | 612 if (this.destinationSearch_.getIsVisible()) { |
| 613 this.destinationSearch_.setIsVisible(false); |
| 614 } else { |
| 615 this.close_(); |
| 616 } |
| 811 e.preventDefault(); | 617 e.preventDefault(); |
| 812 return; | 618 return; |
| 813 } | 619 } |
| 814 | 620 |
| 815 // Ctrl + Shift + p / Mac equivalent. | 621 // Ctrl + Shift + p / Mac equivalent. |
| 816 if (e.keyCode == 80) { | 622 if (e.keyCode == 80) { |
| 817 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || | 623 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || |
| 818 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { | 624 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { |
| 819 this.openSystemPrintDialog_(); | 625 this.openSystemPrintDialog_(); |
| 820 e.preventDefault(); | 626 e.preventDefault(); |
| 821 return; | 627 return; |
| 822 } | 628 } |
| 823 } | 629 } |
| 824 | 630 |
| 825 // Pass certain directional keyboard events to the PDF viewer. | 631 // Pass certain directional keyboard events to the PDF viewer. |
| 826 this.previewArea_.handleDirectionalKeyEvent(e); | 632 this.previewArea_.handleDirectionalKeyEvent(e); |
| 827 }, | 633 }, |
| 828 | 634 |
| 829 /** | 635 /** |
| 830 * Called when native layer receives invalid settings for a print request. | 636 * Called when native layer receives invalid settings for a print request. |
| 831 * @private | 637 * @private |
| 832 */ | 638 */ |
| 833 onSettingsInvalid_: function() { | 639 onSettingsInvalid_: function() { |
| 834 this.uiState_ = PrintPreview.UiState_.ERROR; | 640 this.uiState_ = PrintPreview.UiState_.ERROR; |
| 835 this.previewArea_.showCustomMessage( | 641 this.previewArea_.showCustomMessage( |
| 836 localStrings.getString('invalidPrinterSettings')); | 642 localStrings.getString('invalidPrinterSettings')); |
| 837 }, | 643 }, |
| 838 | 644 |
| 839 /** | 645 /** |
| 646 * Called when the destination settings' change button is activated. |
| 647 * Displays the destination search component. |
| 648 * @private |
| 649 */ |
| 650 onDestinationChangeButtonActivate_: function() { |
| 651 this.destinationSearch_.setIsVisible(true); |
| 652 this.destinationStore_.startLoadAllCloudDestinations(); |
| 653 }, |
| 654 |
| 655 /** |
| 656 * Called when the destination search dispatches manage cloud destinations |
| 657 * event. Calls corresponding native layer method. |
| 658 * @private |
| 659 */ |
| 660 onManageCloudDestinationsActivated_: function() { |
| 661 this.nativeLayer_.startManageCloudDestinations(); |
| 662 }, |
| 663 |
| 664 /** |
| 665 * Called when the destination search dispatches manage local destinations |
| 666 * event. Calls corresponding native layer method. |
| 667 * @private |
| 668 */ |
| 669 onManageLocalDestinationsActivated_: function() { |
| 670 this.nativeLayer_.startManageLocalDestinations(); |
| 671 }, |
| 672 |
| 673 /** |
| 674 * Called when the user wants to sign in to Google Cloud Print. Calls the |
| 675 * corresponding native layer event. |
| 676 * @private |
| 677 */ |
| 678 onCloudPrintSignInActivated_: function() { |
| 679 this.nativeLayer_.startCloudPrintSignIn(); |
| 680 }, |
| 681 |
| 682 /** |
| 840 * Called when the native layer dispatches a DISABLE_SCALING event. Updates | 683 * Called when the native layer dispatches a DISABLE_SCALING event. Updates |
| 841 * the print ticket. | 684 * the print ticket. |
| 842 * @private | 685 * @private |
| 843 */ | 686 */ |
| 844 onDisableScaling_: function() { | 687 onDisableScaling_: function() { |
| 845 this.printTicketStore_.updateFitToPage(false); | 688 this.printTicketStore_.updateFitToPage(false); |
| 846 }, | |
| 847 | |
| 848 /** | |
| 849 * Called when the user selects the "Manage printers..." option in the | |
| 850 * destination select. | |
| 851 * @private | |
| 852 */ | |
| 853 onManagePrinters_: function() { | |
| 854 if (cr.isChromeOS) { | |
| 855 this.nativeLayer_.startManageCloudPrinters(); | |
| 856 } else { | |
| 857 this.nativeLayer_.startManageLocalPrinters(); | |
| 858 } | |
| 859 } | 689 } |
| 860 }; | 690 }; |
| 861 | 691 |
| 862 // Export | 692 // Export |
| 863 return { | 693 return { |
| 864 PrintPreview: PrintPreview | 694 PrintPreview: PrintPreview |
| 865 }; | 695 }; |
| 866 }); | 696 }); |
| 867 | 697 |
| 868 // Pull in all other scripts in a single shot. | 698 // Pull in all other scripts in a single shot. |
| 869 <include src="data/page_number_set.js"/> | 699 <include src="data/page_number_set.js"/> |
| 870 <include src="data/destination.js"/> | 700 <include src="data/destination.js"/> |
| 871 <include src="data/local_parsers.js"/> | 701 <include src="data/local_parsers.js"/> |
| 872 <include src="data/cloud_parsers.js"/> | 702 <include src="data/cloud_parsers.js"/> |
| 873 <include src="data/chromium_capabilities.js"/> | 703 <include src="data/chromium_capabilities.js"/> |
| 874 <include src="data/cloud_capabilities.js"/> | 704 <include src="data/cloud_capabilities.js"/> |
| 875 <include src="data/destination_store.js"/> | 705 <include src="data/destination_store.js"/> |
| 876 <include src="data/margins.js"/> | 706 <include src="data/margins.js"/> |
| 877 <include src="data/document_info.js"/> | 707 <include src="data/document_info.js"/> |
| 878 <include src="data/printable_area.js"/> | 708 <include src="data/printable_area.js"/> |
| 879 <include src="data/measurement_system.js"/> | 709 <include src="data/measurement_system.js"/> |
| 880 <include src="data/print_ticket_store.js"/> | 710 <include src="data/print_ticket_store.js"/> |
| 881 <include src="data/coordinate2d.js"/> | 711 <include src="data/coordinate2d.js"/> |
| 882 <include src="data/size.js"/> | 712 <include src="data/size.js"/> |
| 883 <include src="data/capabilities_holder.js"/> | 713 <include src="data/capabilities_holder.js"/> |
| 714 <include src="data/user_info.js"/> |
| 884 | 715 |
| 885 <include src="data/ticket_items/ticket_item.js"/> | 716 <include src="data/ticket_items/ticket_item.js"/> |
| 886 | 717 |
| 887 <include src="data/ticket_items/custom_margins.js"/> | 718 <include src="data/ticket_items/custom_margins.js"/> |
| 888 <include src="data/ticket_items/collate.js"/> | 719 <include src="data/ticket_items/collate.js"/> |
| 889 <include src="data/ticket_items/color.js"/> | 720 <include src="data/ticket_items/color.js"/> |
| 890 <include src="data/ticket_items/copies.js"/> | 721 <include src="data/ticket_items/copies.js"/> |
| 891 <include src="data/ticket_items/duplex.js"/> | 722 <include src="data/ticket_items/duplex.js"/> |
| 892 <include src="data/ticket_items/header_footer.js"/> | 723 <include src="data/ticket_items/header_footer.js"/> |
| 893 <include src="data/ticket_items/landscape.js"/> | 724 <include src="data/ticket_items/landscape.js"/> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 907 <include src="settings/color_settings.js"/> | 738 <include src="settings/color_settings.js"/> |
| 908 <include src="settings/margin_settings.js"/> | 739 <include src="settings/margin_settings.js"/> |
| 909 <include src="settings/destination_settings.js"/> | 740 <include src="settings/destination_settings.js"/> |
| 910 <include src="settings/other_options_settings.js"/> | 741 <include src="settings/other_options_settings.js"/> |
| 911 | 742 |
| 912 <include src="previewarea/margin_control.js"/> | 743 <include src="previewarea/margin_control.js"/> |
| 913 <include src="previewarea/margin_control_container.js"/> | 744 <include src="previewarea/margin_control_container.js"/> |
| 914 <include src="previewarea/preview_area.js"/> | 745 <include src="previewarea/preview_area.js"/> |
| 915 <include src="preview_generator.js"/> | 746 <include src="preview_generator.js"/> |
| 916 | 747 |
| 917 var printPreview = new print_preview.PrintPreview(); | 748 <include src="search/destination_list.js"/> |
| 749 <include src="search/cloud_destination_list.js"/> |
| 750 <include src="search/destination_list_item.js"/> |
| 751 <include src="search/destination_search.js"/> |
| 752 <include src="search/search_box.js"/> |
| 753 |
| 754 window.addEventListener('DOMContentLoaded', function() { |
| 755 printPreview = new print_preview.PrintPreview(); |
| 756 printPreview.initialize(); |
| 757 }); |
| OLD | NEW |