Chromium Code Reviews| 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.exportPath('print_preview'); | 5 cr.exportPath('print_preview'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{selectSaveAsPdfDestination: boolean, | 8 * @typedef {{selectSaveAsPdfDestination: boolean, |
| 9 * layoutSettings.portrait: boolean, | 9 * layoutSettings.portrait: boolean, |
| 10 * pageRange: string, | 10 * pageRange: string, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * }} | 23 * }} |
| 24 */ | 24 */ |
| 25 print_preview.PrinterSetupResponse; | 25 print_preview.PrinterSetupResponse; |
| 26 | 26 |
| 27 cr.define('print_preview', function() { | 27 cr.define('print_preview', function() { |
| 28 'use strict'; | 28 'use strict'; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * An interface to the native Chromium printing system layer. | 31 * An interface to the native Chromium printing system layer. |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {cr.EventTarget} | |
| 34 */ | 33 */ |
| 35 function NativeLayer() { | 34 function NativeLayer() { |
| 36 cr.EventTarget.call(this); | |
| 37 | |
| 38 // Bind global handlers | 35 // Bind global handlers |
| 39 global.setInitialSettings = this.onSetInitialSettings_.bind(this); | |
| 40 global.setUseCloudPrint = this.onSetUseCloudPrint_.bind(this); | 36 global.setUseCloudPrint = this.onSetUseCloudPrint_.bind(this); |
| 41 global.setPrinters = this.onSetPrinters_.bind(this); | 37 global.setPrinters = this.onSetPrinters_.bind(this); |
| 42 global.updateWithPrinterCapabilities = | 38 global.updateWithPrinterCapabilities = |
| 43 this.onUpdateWithPrinterCapabilities_.bind(this); | 39 this.onUpdateWithPrinterCapabilities_.bind(this); |
| 44 global.failedToGetPrinterCapabilities = | 40 global.failedToGetPrinterCapabilities = |
| 45 this.onFailedToGetPrinterCapabilities_.bind(this); | 41 this.onFailedToGetPrinterCapabilities_.bind(this); |
| 46 global.failedToGetPrivetPrinterCapabilities = | 42 global.failedToGetPrivetPrinterCapabilities = |
| 47 this.onFailedToGetPrivetPrinterCapabilities_.bind(this); | 43 this.onFailedToGetPrivetPrinterCapabilities_.bind(this); |
| 48 global.failedToGetExtensionPrinterCapabilities = | 44 global.failedToGetExtensionPrinterCapabilities = |
| 49 this.onFailedToGetExtensionPrinterCapabilities_.bind(this); | 45 this.onFailedToGetExtensionPrinterCapabilities_.bind(this); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 72 global.onExtensionCapabilitiesSet = | 68 global.onExtensionCapabilitiesSet = |
| 73 this.onExtensionCapabilitiesSet_.bind(this); | 69 this.onExtensionCapabilitiesSet_.bind(this); |
| 74 global.onEnableManipulateSettingsForTest = | 70 global.onEnableManipulateSettingsForTest = |
| 75 this.onEnableManipulateSettingsForTest_.bind(this); | 71 this.onEnableManipulateSettingsForTest_.bind(this); |
| 76 global.printPresetOptionsFromDocument = | 72 global.printPresetOptionsFromDocument = |
| 77 this.onPrintPresetOptionsFromDocument_.bind(this); | 73 this.onPrintPresetOptionsFromDocument_.bind(this); |
| 78 global.onProvisionalPrinterResolved = | 74 global.onProvisionalPrinterResolved = |
| 79 this.onProvisionalDestinationResolved_.bind(this); | 75 this.onProvisionalDestinationResolved_.bind(this); |
| 80 global.failedToResolveProvisionalPrinter = | 76 global.failedToResolveProvisionalPrinter = |
| 81 this.failedToResolveProvisionalDestination_.bind(this); | 77 this.failedToResolveProvisionalDestination_.bind(this); |
| 78 | |
| 79 this.eventTarget_ = new cr.EventTarget(); | |
|
dpapad
2017/05/17 23:59:12
@private {!cr.EventTarget}
rbpotter
2017/05/18 17:56:30
Done.
| |
| 82 } | 80 } |
| 83 | 81 |
| 84 /** | 82 /** |
| 85 * Event types dispatched from the Chromium native layer. | 83 * Event types dispatched from the Chromium native layer. |
| 86 * @enum {string} | 84 * @enum {string} |
| 87 * @const | 85 * @const |
| 88 */ | 86 */ |
| 89 NativeLayer.EventType = { | 87 NativeLayer.EventType = { |
| 90 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', | 88 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', |
| 91 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', | 89 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', |
| 92 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', | 90 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', |
| 93 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', | 91 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', |
| 94 DISABLE_SCALING: 'print_preview.NativeLayer.DISABLE_SCALING', | 92 DISABLE_SCALING: 'print_preview.NativeLayer.DISABLE_SCALING', |
| 95 FILE_SELECTION_CANCEL: 'print_preview.NativeLayer.FILE_SELECTION_CANCEL', | 93 FILE_SELECTION_CANCEL: 'print_preview.NativeLayer.FILE_SELECTION_CANCEL', |
| 96 FILE_SELECTION_COMPLETE: | 94 FILE_SELECTION_COMPLETE: |
| 97 'print_preview.NativeLayer.FILE_SELECTION_COMPLETE', | 95 'print_preview.NativeLayer.FILE_SELECTION_COMPLETE', |
| 98 GET_CAPABILITIES_FAIL: 'print_preview.NativeLayer.GET_CAPABILITIES_FAIL', | 96 GET_CAPABILITIES_FAIL: 'print_preview.NativeLayer.GET_CAPABILITIES_FAIL', |
| 99 INITIAL_SETTINGS_SET: 'print_preview.NativeLayer.INITIAL_SETTINGS_SET', | |
| 100 LOCAL_DESTINATIONS_SET: 'print_preview.NativeLayer.LOCAL_DESTINATIONS_SET', | 97 LOCAL_DESTINATIONS_SET: 'print_preview.NativeLayer.LOCAL_DESTINATIONS_SET', |
| 101 MANIPULATE_SETTINGS_FOR_TEST: | 98 MANIPULATE_SETTINGS_FOR_TEST: |
| 102 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', | 99 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', |
| 103 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', | 100 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', |
| 104 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', | 101 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', |
| 105 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', | 102 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', |
| 106 PREVIEW_GENERATION_DONE: | 103 PREVIEW_GENERATION_DONE: |
| 107 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', | 104 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', |
| 108 PREVIEW_GENERATION_FAIL: | 105 PREVIEW_GENERATION_FAIL: |
| 109 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', | 106 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 141 |
| 145 /** | 142 /** |
| 146 * Version of the serialized state of the print preview. | 143 * Version of the serialized state of the print preview. |
| 147 * @type {number} | 144 * @type {number} |
| 148 * @const | 145 * @const |
| 149 * @private | 146 * @private |
| 150 */ | 147 */ |
| 151 NativeLayer.SERIALIZED_STATE_VERSION_ = 1; | 148 NativeLayer.SERIALIZED_STATE_VERSION_ = 1; |
| 152 | 149 |
| 153 NativeLayer.prototype = { | 150 NativeLayer.prototype = { |
| 154 __proto__: cr.EventTarget.prototype, | 151 /** |
| 152 * Returns the event target for the native layer. | |
| 153 * @return {!cr.EventTarget} | |
|
dpapad
2017/05/17 23:59:12
Nit:
@return {!cr.EventTarget} The event target fo
rbpotter
2017/05/18 17:56:30
Done.
| |
| 154 */ | |
| 155 getEventTarget: function() { | |
| 156 return this.eventTarget_; | |
| 157 }, | |
| 155 | 158 |
| 156 /** | 159 /** |
| 157 * Requests access token for cloud print requests. | 160 * Requests access token for cloud print requests. |
| 158 * @param {string} authType type of access token. | 161 * @param {string} authType type of access token. |
| 159 */ | 162 */ |
| 160 startGetAccessToken: function(authType) { | 163 startGetAccessToken: function(authType) { |
| 161 chrome.send('getAccessToken', [authType]); | 164 chrome.send('getAccessToken', [authType]); |
| 162 }, | 165 }, |
| 163 | 166 |
| 164 /** Gets the initial settings to initialize the print preview with. */ | 167 /** |
| 165 startGetInitialSettings: function() { | 168 * Gets the initial settings to initialize the print preview with. |
| 166 chrome.send('getInitialSettings'); | 169 * @return {!Promise<print_preview.NativeInitialSettings>} |
|
dpapad
2017/05/17 23:59:12
Shouldn't this be
!Promise<!print_preview.NativeIn
rbpotter
2017/05/18 17:56:30
Done.
| |
| 170 */ | |
| 171 getInitialSettings: function() { | |
| 172 return cr.sendWithPromise('getInitialSettings').then( | |
| 173 /** | |
| 174 * @param {!Object} initialSettings Object containing the raw | |
| 175 * Print Preview settings. | |
| 176 */ | |
| 177 function(initialSettings) { | |
| 178 var numberFormatSymbols = | |
| 179 print_preview.MeasurementSystem.parseNumberFormat( | |
| 180 initialSettings['numberFormat']); | |
| 181 var unitType = print_preview.MeasurementSystemUnitType.IMPERIAL; | |
| 182 if (initialSettings['measurementSystem'] != null) { | |
| 183 unitType = initialSettings['measurementSystem']; | |
| 184 } | |
| 185 return new print_preview.NativeInitialSettings( | |
| 186 initialSettings['printAutomaticallyInKioskMode'] || false, | |
| 187 initialSettings['appKioskMode'] || false, | |
| 188 numberFormatSymbols[0] || ',', | |
| 189 numberFormatSymbols[1] || '.', | |
| 190 unitType, | |
| 191 initialSettings['previewModifiable'] || false, | |
| 192 initialSettings['initiatorTitle'] || '', | |
| 193 initialSettings['documentHasSelection'] || false, | |
| 194 initialSettings['shouldPrintSelectionOnly'] || false, | |
| 195 initialSettings['printerName'] || null, | |
| 196 initialSettings['appState'] || null, | |
| 197 initialSettings['defaultDestinationSelectionRules'] || null); | |
| 198 }); | |
| 167 }, | 199 }, |
| 168 | 200 |
| 169 /** | 201 /** |
| 170 * Requests the system's local print destinations. A LOCAL_DESTINATIONS_SET | 202 * Requests the system's local print destinations. A LOCAL_DESTINATIONS_SET |
| 171 * event will be dispatched in response. | 203 * event will be dispatched in response. |
| 172 */ | 204 */ |
| 173 startGetLocalDestinations: function() { | 205 startGetLocalDestinations: function() { |
| 174 chrome.send('getPrinters'); | 206 chrome.send('getPrinters'); |
| 175 }, | 207 }, |
| 176 | 208 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 startManageCloudDestinations: function(user) { | 510 startManageCloudDestinations: function(user) { |
| 479 chrome.send('manageCloudPrinters', [user || '']); | 511 chrome.send('manageCloudPrinters', [user || '']); |
| 480 }, | 512 }, |
| 481 | 513 |
| 482 /** Forces browser to open a new tab with the given URL address. */ | 514 /** Forces browser to open a new tab with the given URL address. */ |
| 483 startForceOpenNewTab: function(url) { | 515 startForceOpenNewTab: function(url) { |
| 484 chrome.send('forceOpenNewTab', [url]); | 516 chrome.send('forceOpenNewTab', [url]); |
| 485 }, | 517 }, |
| 486 | 518 |
| 487 /** | 519 /** |
| 488 * @param {!Object} initialSettings Object containing all initial settings. | |
| 489 */ | |
| 490 onSetInitialSettings_: function(initialSettings) { | |
| 491 var numberFormatSymbols = | |
| 492 print_preview.MeasurementSystem.parseNumberFormat( | |
| 493 initialSettings['numberFormat']); | |
| 494 var unitType = print_preview.MeasurementSystemUnitType.IMPERIAL; | |
| 495 if (initialSettings['measurementSystem'] != null) { | |
| 496 unitType = initialSettings['measurementSystem']; | |
| 497 } | |
| 498 | |
| 499 var nativeInitialSettings = new print_preview.NativeInitialSettings( | |
| 500 initialSettings['printAutomaticallyInKioskMode'] || false, | |
| 501 initialSettings['appKioskMode'] || false, | |
| 502 numberFormatSymbols[0] || ',', | |
| 503 numberFormatSymbols[1] || '.', | |
| 504 unitType, | |
| 505 initialSettings['previewModifiable'] || false, | |
| 506 initialSettings['initiatorTitle'] || '', | |
| 507 initialSettings['documentHasSelection'] || false, | |
| 508 initialSettings['shouldPrintSelectionOnly'] || false, | |
| 509 initialSettings['printerName'] || null, | |
| 510 initialSettings['appState'] || null, | |
| 511 initialSettings['defaultDestinationSelectionRules'] || null); | |
| 512 | |
| 513 var initialSettingsSetEvent = new Event( | |
| 514 NativeLayer.EventType.INITIAL_SETTINGS_SET); | |
| 515 initialSettingsSetEvent.initialSettings = nativeInitialSettings; | |
| 516 this.dispatchEvent(initialSettingsSetEvent); | |
| 517 }, | |
| 518 | |
| 519 /** | |
| 520 * Turn on the integration of Cloud Print. | 520 * Turn on the integration of Cloud Print. |
| 521 * @param {{cloudPrintURL: string, appKioskMode: string}} settings | 521 * @param {{cloudPrintURL: string, appKioskMode: string}} settings |
| 522 * cloudPrintUrl: The URL to use for cloud print servers. | 522 * cloudPrintUrl: The URL to use for cloud print servers. |
| 523 * @private | 523 * @private |
| 524 */ | 524 */ |
| 525 onSetUseCloudPrint_: function(settings) { | 525 onSetUseCloudPrint_: function(settings) { |
| 526 var cloudPrintEnableEvent = new Event( | 526 var cloudPrintEnableEvent = new Event( |
| 527 NativeLayer.EventType.CLOUD_PRINT_ENABLE); | 527 NativeLayer.EventType.CLOUD_PRINT_ENABLE); |
| 528 cloudPrintEnableEvent.baseCloudPrintUrl = settings['cloudPrintUrl'] || ''; | 528 cloudPrintEnableEvent.baseCloudPrintUrl = settings['cloudPrintUrl'] || ''; |
| 529 cloudPrintEnableEvent.appKioskMode = settings['appKioskMode'] || false; | 529 cloudPrintEnableEvent.appKioskMode = settings['appKioskMode'] || false; |
| 530 this.dispatchEvent(cloudPrintEnableEvent); | 530 this.eventTarget_.dispatchEvent(cloudPrintEnableEvent); |
| 531 }, | 531 }, |
| 532 | 532 |
| 533 /** | 533 /** |
| 534 * Updates the print preview with local printers. | 534 * Updates the print preview with local printers. |
| 535 * Called from PrintPreviewHandler::SetupPrinterList(). | 535 * Called from PrintPreviewHandler::SetupPrinterList(). |
| 536 * @param {Array} printers Array of printer info objects. | 536 * @param {Array} printers Array of printer info objects. |
| 537 * @private | 537 * @private |
| 538 */ | 538 */ |
| 539 onSetPrinters_: function(printers) { | 539 onSetPrinters_: function(printers) { |
| 540 var localDestsSetEvent = new Event( | 540 var localDestsSetEvent = new Event( |
| 541 NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 541 NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 542 localDestsSetEvent.destinationInfos = printers; | 542 localDestsSetEvent.destinationInfos = printers; |
| 543 this.dispatchEvent(localDestsSetEvent); | 543 this.eventTarget_.dispatchEvent(localDestsSetEvent); |
| 544 }, | 544 }, |
| 545 | 545 |
| 546 /** | 546 /** |
| 547 * Called when native layer gets settings information for a requested local | 547 * Called when native layer gets settings information for a requested local |
| 548 * destination. | 548 * destination. |
| 549 * @param {Object} settingsInfo printer setting information. | 549 * @param {Object} settingsInfo printer setting information. |
| 550 * @private | 550 * @private |
| 551 */ | 551 */ |
| 552 onUpdateWithPrinterCapabilities_: function(settingsInfo) { | 552 onUpdateWithPrinterCapabilities_: function(settingsInfo) { |
| 553 assert(settingsInfo.capabilities, | 553 assert(settingsInfo.capabilities, |
| 554 'Capabilities update without capabilites'); | 554 'Capabilities update without capabilites'); |
| 555 var capsSetEvent = new Event(NativeLayer.EventType.CAPABILITIES_SET); | 555 var capsSetEvent = new Event(NativeLayer.EventType.CAPABILITIES_SET); |
| 556 capsSetEvent.settingsInfo = settingsInfo; | 556 capsSetEvent.settingsInfo = settingsInfo; |
| 557 this.dispatchEvent(capsSetEvent); | 557 this.eventTarget_.dispatchEvent(capsSetEvent); |
| 558 }, | 558 }, |
| 559 | 559 |
| 560 /** | 560 /** |
| 561 * Called when native layer gets settings information for a requested local | 561 * Called when native layer gets settings information for a requested local |
| 562 * destination. | 562 * destination. |
| 563 * @param {string} destinationId Printer affected by error. | 563 * @param {string} destinationId Printer affected by error. |
| 564 * @private | 564 * @private |
| 565 */ | 565 */ |
| 566 onFailedToGetPrinterCapabilities_: function(destinationId) { | 566 onFailedToGetPrinterCapabilities_: function(destinationId) { |
| 567 var getCapsFailEvent = new Event( | 567 var getCapsFailEvent = new Event( |
| 568 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | 568 NativeLayer.EventType.GET_CAPABILITIES_FAIL); |
| 569 getCapsFailEvent.destinationId = destinationId; | 569 getCapsFailEvent.destinationId = destinationId; |
| 570 getCapsFailEvent.destinationOrigin = | 570 getCapsFailEvent.destinationOrigin = |
| 571 print_preview.DestinationOrigin.LOCAL; | 571 print_preview.DestinationOrigin.LOCAL; |
| 572 this.dispatchEvent(getCapsFailEvent); | 572 this.eventTarget_.dispatchEvent(getCapsFailEvent); |
| 573 }, | 573 }, |
| 574 | 574 |
| 575 /** | 575 /** |
| 576 * Called when native layer gets settings information for a requested privet | 576 * Called when native layer gets settings information for a requested privet |
| 577 * destination. | 577 * destination. |
| 578 * @param {string} destinationId Printer affected by error. | 578 * @param {string} destinationId Printer affected by error. |
| 579 * @private | 579 * @private |
| 580 */ | 580 */ |
| 581 onFailedToGetPrivetPrinterCapabilities_: function(destinationId) { | 581 onFailedToGetPrivetPrinterCapabilities_: function(destinationId) { |
| 582 var getCapsFailEvent = new Event( | 582 var getCapsFailEvent = new Event( |
| 583 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | 583 NativeLayer.EventType.GET_CAPABILITIES_FAIL); |
| 584 getCapsFailEvent.destinationId = destinationId; | 584 getCapsFailEvent.destinationId = destinationId; |
| 585 getCapsFailEvent.destinationOrigin = | 585 getCapsFailEvent.destinationOrigin = |
| 586 print_preview.DestinationOrigin.PRIVET; | 586 print_preview.DestinationOrigin.PRIVET; |
| 587 this.dispatchEvent(getCapsFailEvent); | 587 this.eventTarget_.dispatchEvent(getCapsFailEvent); |
| 588 }, | 588 }, |
| 589 | 589 |
| 590 /** | 590 /** |
| 591 * Called when native layer fails to get settings information for a | 591 * Called when native layer fails to get settings information for a |
| 592 * requested extension destination. | 592 * requested extension destination. |
| 593 * @param {string} destinationId Printer affected by error. | 593 * @param {string} destinationId Printer affected by error. |
| 594 * @private | 594 * @private |
| 595 */ | 595 */ |
| 596 onFailedToGetExtensionPrinterCapabilities_: function(destinationId) { | 596 onFailedToGetExtensionPrinterCapabilities_: function(destinationId) { |
| 597 var getCapsFailEvent = new Event( | 597 var getCapsFailEvent = new Event( |
| 598 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | 598 NativeLayer.EventType.GET_CAPABILITIES_FAIL); |
| 599 getCapsFailEvent.destinationId = destinationId; | 599 getCapsFailEvent.destinationId = destinationId; |
| 600 getCapsFailEvent.destinationOrigin = | 600 getCapsFailEvent.destinationOrigin = |
| 601 print_preview.DestinationOrigin.EXTENSION; | 601 print_preview.DestinationOrigin.EXTENSION; |
| 602 this.dispatchEvent(getCapsFailEvent); | 602 this.eventTarget_.dispatchEvent(getCapsFailEvent); |
| 603 }, | 603 }, |
| 604 | 604 |
| 605 /** Reloads the printer list. */ | 605 /** Reloads the printer list. */ |
| 606 onReloadPrintersList_: function() { | 606 onReloadPrintersList_: function() { |
| 607 cr.dispatchSimpleEvent(this, NativeLayer.EventType.DESTINATIONS_RELOAD); | 607 cr.dispatchSimpleEvent(this.eventTarget_, |
| 608 NativeLayer.EventType.DESTINATIONS_RELOAD); | |
| 608 }, | 609 }, |
| 609 | 610 |
| 610 /** | 611 /** |
| 611 * Called from the C++ layer. | 612 * Called from the C++ layer. |
| 612 * Take the PDF data handed to us and submit it to the cloud, closing the | 613 * Take the PDF data handed to us and submit it to the cloud, closing the |
| 613 * print preview dialog once the upload is successful. | 614 * print preview dialog once the upload is successful. |
| 614 * @param {string} data Data to send as the print job. | 615 * @param {string} data Data to send as the print job. |
| 615 * @private | 616 * @private |
| 616 */ | 617 */ |
| 617 onPrintToCloud_: function(data) { | 618 onPrintToCloud_: function(data) { |
| 618 var printToCloudEvent = new Event( | 619 var printToCloudEvent = new Event( |
| 619 NativeLayer.EventType.PRINT_TO_CLOUD); | 620 NativeLayer.EventType.PRINT_TO_CLOUD); |
| 620 printToCloudEvent.data = data; | 621 printToCloudEvent.data = data; |
| 621 this.dispatchEvent(printToCloudEvent); | 622 this.eventTarget_.dispatchEvent(printToCloudEvent); |
| 622 }, | 623 }, |
| 623 | 624 |
| 624 /** | 625 /** |
| 625 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print | 626 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print |
| 626 * preview dialog regarding the file selection cancel event. | 627 * preview dialog regarding the file selection cancel event. |
| 627 * @private | 628 * @private |
| 628 */ | 629 */ |
| 629 onFileSelectionCancelled_: function() { | 630 onFileSelectionCancelled_: function() { |
| 630 cr.dispatchSimpleEvent(this, NativeLayer.EventType.FILE_SELECTION_CANCEL); | 631 cr.dispatchSimpleEvent( |
| 632 this.eventTarget_, NativeLayer.EventType.FILE_SELECTION_CANCEL); | |
| 631 }, | 633 }, |
| 632 | 634 |
| 633 /** | 635 /** |
| 634 * Called from PrintPreviewUI::OnFileSelectionCompleted to notify the print | 636 * Called from PrintPreviewUI::OnFileSelectionCompleted to notify the print |
| 635 * preview dialog regarding the file selection completed event. | 637 * preview dialog regarding the file selection completed event. |
| 636 * @private | 638 * @private |
| 637 */ | 639 */ |
| 638 onFileSelectionCompleted_: function() { | 640 onFileSelectionCompleted_: function() { |
| 639 // If the file selection is completed and the dialog is not already closed | 641 // If the file selection is completed and the dialog is not already closed |
| 640 // it means that a pending print to pdf request exists. | 642 // it means that a pending print to pdf request exists. |
| 641 cr.dispatchSimpleEvent( | 643 cr.dispatchSimpleEvent( |
| 642 this, NativeLayer.EventType.FILE_SELECTION_COMPLETE); | 644 this.eventTarget_, NativeLayer.EventType.FILE_SELECTION_COMPLETE); |
| 643 }, | 645 }, |
| 644 | 646 |
| 645 /** | 647 /** |
| 646 * Display an error message when print preview fails. | 648 * Display an error message when print preview fails. |
| 647 * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). | 649 * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). |
| 648 * @private | 650 * @private |
| 649 */ | 651 */ |
| 650 onPrintPreviewFailed_: function() { | 652 onPrintPreviewFailed_: function() { |
| 651 cr.dispatchSimpleEvent( | 653 cr.dispatchSimpleEvent( |
| 652 this, NativeLayer.EventType.PREVIEW_GENERATION_FAIL); | 654 this.eventTarget_, NativeLayer.EventType.PREVIEW_GENERATION_FAIL); |
| 653 }, | 655 }, |
| 654 | 656 |
| 655 /** | 657 /** |
| 656 * Display an error message when encountered invalid printer settings. | 658 * Display an error message when encountered invalid printer settings. |
| 657 * Called from PrintPreviewMessageHandler::OnInvalidPrinterSettings(). | 659 * Called from PrintPreviewMessageHandler::OnInvalidPrinterSettings(). |
| 658 * @private | 660 * @private |
| 659 */ | 661 */ |
| 660 onInvalidPrinterSettings_: function() { | 662 onInvalidPrinterSettings_: function() { |
| 661 cr.dispatchSimpleEvent(this, NativeLayer.EventType.SETTINGS_INVALID); | 663 cr.dispatchSimpleEvent(this.eventTarget_, |
| 664 NativeLayer.EventType.SETTINGS_INVALID); | |
| 662 }, | 665 }, |
| 663 | 666 |
| 664 /** | 667 /** |
| 665 * @param {{contentWidth: number, contentHeight: number, marginLeft: number, | 668 * @param {{contentWidth: number, contentHeight: number, marginLeft: number, |
| 666 * marginRight: number, marginTop: number, marginBottom: number, | 669 * marginRight: number, marginTop: number, marginBottom: number, |
| 667 * printableAreaX: number, printableAreaY: number, | 670 * printableAreaX: number, printableAreaY: number, |
| 668 * printableAreaWidth: number, printableAreaHeight: number}} | 671 * printableAreaWidth: number, printableAreaHeight: number}} |
| 669 * pageLayout Specifies default page layout details in points. | 672 * pageLayout Specifies default page layout details in points. |
| 670 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed | 673 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed |
| 671 * document has a custom page size style. | 674 * document has a custom page size style. |
| 672 * @private | 675 * @private |
| 673 */ | 676 */ |
| 674 onDidGetDefaultPageLayout_: function(pageLayout, hasCustomPageSizeStyle) { | 677 onDidGetDefaultPageLayout_: function(pageLayout, hasCustomPageSizeStyle) { |
| 675 var pageLayoutChangeEvent = new Event( | 678 var pageLayoutChangeEvent = new Event( |
| 676 NativeLayer.EventType.PAGE_LAYOUT_READY); | 679 NativeLayer.EventType.PAGE_LAYOUT_READY); |
| 677 pageLayoutChangeEvent.pageLayout = pageLayout; | 680 pageLayoutChangeEvent.pageLayout = pageLayout; |
| 678 pageLayoutChangeEvent.hasCustomPageSizeStyle = hasCustomPageSizeStyle; | 681 pageLayoutChangeEvent.hasCustomPageSizeStyle = hasCustomPageSizeStyle; |
| 679 this.dispatchEvent(pageLayoutChangeEvent); | 682 this.eventTarget_.dispatchEvent(pageLayoutChangeEvent); |
| 680 }, | 683 }, |
| 681 | 684 |
| 682 /** | 685 /** |
| 683 * Update the page count and check the page range. | 686 * Update the page count and check the page range. |
| 684 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). | 687 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). |
| 685 * @param {number} pageCount The number of pages. | 688 * @param {number} pageCount The number of pages. |
| 686 * @param {number} previewResponseId The preview request id that resulted in | 689 * @param {number} previewResponseId The preview request id that resulted in |
| 687 * this response. | 690 * this response. |
| 688 * @param {number} fitToPageScaling The scaling percentage required to fit | 691 * @param {number} fitToPageScaling The scaling percentage required to fit |
| 689 * the document to page, rounded to the nearest integer. | 692 * the document to page, rounded to the nearest integer. |
| 690 * @private | 693 * @private |
| 691 */ | 694 */ |
| 692 onDidGetPreviewPageCount_: function(pageCount, previewResponseId, | 695 onDidGetPreviewPageCount_: function(pageCount, previewResponseId, |
| 693 fitToPageScaling) { | 696 fitToPageScaling) { |
| 694 var pageCountChangeEvent = new Event( | 697 var pageCountChangeEvent = new Event( |
| 695 NativeLayer.EventType.PAGE_COUNT_READY); | 698 NativeLayer.EventType.PAGE_COUNT_READY); |
| 696 pageCountChangeEvent.pageCount = pageCount; | 699 pageCountChangeEvent.pageCount = pageCount; |
| 697 pageCountChangeEvent.previewResponseId = previewResponseId; | 700 pageCountChangeEvent.previewResponseId = previewResponseId; |
| 698 pageCountChangeEvent.fitToPageScaling = fitToPageScaling; | 701 pageCountChangeEvent.fitToPageScaling = fitToPageScaling; |
| 699 this.dispatchEvent(pageCountChangeEvent); | 702 this.eventTarget_.dispatchEvent(pageCountChangeEvent); |
| 700 }, | 703 }, |
| 701 | 704 |
| 702 /** | 705 /** |
| 703 * Notification that a print preview page has been rendered. | 706 * Notification that a print preview page has been rendered. |
| 704 * Check if the settings have changed and request a regeneration if needed. | 707 * Check if the settings have changed and request a regeneration if needed. |
| 705 * Called from PrintPreviewUI::OnDidPreviewPage(). | 708 * Called from PrintPreviewUI::OnDidPreviewPage(). |
| 706 * @param {number} pageNumber The page number, 0-based. | 709 * @param {number} pageNumber The page number, 0-based. |
| 707 * @param {number} previewUid Preview unique identifier. | 710 * @param {number} previewUid Preview unique identifier. |
| 708 * @param {number} previewResponseId The preview request id that resulted in | 711 * @param {number} previewResponseId The preview request id that resulted in |
| 709 * this response. | 712 * this response. |
| 710 * @private | 713 * @private |
| 711 */ | 714 */ |
| 712 onDidPreviewPage_: function(pageNumber, previewUid, previewResponseId) { | 715 onDidPreviewPage_: function(pageNumber, previewUid, previewResponseId) { |
| 713 var pagePreviewGenEvent = new Event( | 716 var pagePreviewGenEvent = new Event( |
| 714 NativeLayer.EventType.PAGE_PREVIEW_READY); | 717 NativeLayer.EventType.PAGE_PREVIEW_READY); |
| 715 pagePreviewGenEvent.pageIndex = pageNumber; | 718 pagePreviewGenEvent.pageIndex = pageNumber; |
| 716 pagePreviewGenEvent.previewUid = previewUid; | 719 pagePreviewGenEvent.previewUid = previewUid; |
| 717 pagePreviewGenEvent.previewResponseId = previewResponseId; | 720 pagePreviewGenEvent.previewResponseId = previewResponseId; |
| 718 this.dispatchEvent(pagePreviewGenEvent); | 721 this.eventTarget_.dispatchEvent(pagePreviewGenEvent); |
| 719 }, | 722 }, |
| 720 | 723 |
| 721 /** | 724 /** |
| 722 * Notification that access token is ready. | 725 * Notification that access token is ready. |
| 723 * @param {string} authType Type of access token. | 726 * @param {string} authType Type of access token. |
| 724 * @param {string} accessToken Access token. | 727 * @param {string} accessToken Access token. |
| 725 * @private | 728 * @private |
| 726 */ | 729 */ |
| 727 onDidGetAccessToken_: function(authType, accessToken) { | 730 onDidGetAccessToken_: function(authType, accessToken) { |
| 728 var getAccessTokenEvent = new Event( | 731 var getAccessTokenEvent = new Event( |
| 729 NativeLayer.EventType.ACCESS_TOKEN_READY); | 732 NativeLayer.EventType.ACCESS_TOKEN_READY); |
| 730 getAccessTokenEvent.authType = authType; | 733 getAccessTokenEvent.authType = authType; |
| 731 getAccessTokenEvent.accessToken = accessToken; | 734 getAccessTokenEvent.accessToken = accessToken; |
| 732 this.dispatchEvent(getAccessTokenEvent); | 735 this.eventTarget_.dispatchEvent(getAccessTokenEvent); |
| 733 }, | 736 }, |
| 734 | 737 |
| 735 /** | 738 /** |
| 736 * Update the print preview when new preview data is available. | 739 * Update the print preview when new preview data is available. |
| 737 * Create the PDF plugin as needed. | 740 * Create the PDF plugin as needed. |
| 738 * Called from PrintPreviewUI::PreviewDataIsAvailable(). | 741 * Called from PrintPreviewUI::PreviewDataIsAvailable(). |
| 739 * @param {number} previewUid Preview unique identifier. | 742 * @param {number} previewUid Preview unique identifier. |
| 740 * @param {number} previewResponseId The preview request id that resulted in | 743 * @param {number} previewResponseId The preview request id that resulted in |
| 741 * this response. | 744 * this response. |
| 742 * @private | 745 * @private |
| 743 */ | 746 */ |
| 744 onUpdatePrintPreview_: function(previewUid, previewResponseId) { | 747 onUpdatePrintPreview_: function(previewUid, previewResponseId) { |
| 745 var previewGenDoneEvent = new Event( | 748 var previewGenDoneEvent = new Event( |
| 746 NativeLayer.EventType.PREVIEW_GENERATION_DONE); | 749 NativeLayer.EventType.PREVIEW_GENERATION_DONE); |
| 747 previewGenDoneEvent.previewUid = previewUid; | 750 previewGenDoneEvent.previewUid = previewUid; |
| 748 previewGenDoneEvent.previewResponseId = previewResponseId; | 751 previewGenDoneEvent.previewResponseId = previewResponseId; |
| 749 this.dispatchEvent(previewGenDoneEvent); | 752 this.eventTarget_.dispatchEvent(previewGenDoneEvent); |
| 750 }, | 753 }, |
| 751 | 754 |
| 752 /** | 755 /** |
| 753 * Updates print preset options from source PDF document. | 756 * Updates print preset options from source PDF document. |
| 754 * Called from PrintPreviewUI::OnSetOptionsFromDocument(). | 757 * Called from PrintPreviewUI::OnSetOptionsFromDocument(). |
| 755 * @param {{disableScaling: boolean, copies: number, | 758 * @param {{disableScaling: boolean, copies: number, |
| 756 * duplex: number}} options Specifies | 759 * duplex: number}} options Specifies |
| 757 * printing options according to source document presets. | 760 * printing options according to source document presets. |
| 758 * @private | 761 * @private |
| 759 */ | 762 */ |
| 760 onPrintPresetOptionsFromDocument_: function(options) { | 763 onPrintPresetOptionsFromDocument_: function(options) { |
| 761 var printPresetOptionsEvent = new Event( | 764 var printPresetOptionsEvent = new Event( |
| 762 NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 765 NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
| 763 printPresetOptionsEvent.optionsFromDocument = options; | 766 printPresetOptionsEvent.optionsFromDocument = options; |
| 764 this.dispatchEvent(printPresetOptionsEvent); | 767 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); |
| 765 }, | 768 }, |
| 766 | 769 |
| 767 /** | 770 /** |
| 768 * @param {{serviceName: string, name: string}} printer Specifies | 771 * @param {{serviceName: string, name: string}} printer Specifies |
| 769 * information about the printer that was added. | 772 * information about the printer that was added. |
| 770 * @private | 773 * @private |
| 771 */ | 774 */ |
| 772 onPrivetPrinterChanged_: function(printer) { | 775 onPrivetPrinterChanged_: function(printer) { |
| 773 var privetPrinterChangedEvent = | 776 var privetPrinterChangedEvent = |
| 774 new Event(NativeLayer.EventType.PRIVET_PRINTER_CHANGED); | 777 new Event(NativeLayer.EventType.PRIVET_PRINTER_CHANGED); |
| 775 privetPrinterChangedEvent.printer = printer; | 778 privetPrinterChangedEvent.printer = printer; |
| 776 this.dispatchEvent(privetPrinterChangedEvent); | 779 this.eventTarget_.dispatchEvent(privetPrinterChangedEvent); |
| 777 }, | 780 }, |
| 778 | 781 |
| 779 /** | 782 /** |
| 780 * @param {Object} printer Specifies information about the printer that was | 783 * @param {Object} printer Specifies information about the printer that was |
| 781 * added. | 784 * added. |
| 782 * @private | 785 * @private |
| 783 */ | 786 */ |
| 784 onPrivetCapabilitiesSet_: function(printer, capabilities) { | 787 onPrivetCapabilitiesSet_: function(printer, capabilities) { |
| 785 var privetCapabilitiesSetEvent = | 788 var privetCapabilitiesSetEvent = |
| 786 new Event(NativeLayer.EventType.PRIVET_CAPABILITIES_SET); | 789 new Event(NativeLayer.EventType.PRIVET_CAPABILITIES_SET); |
| 787 privetCapabilitiesSetEvent.printer = printer; | 790 privetCapabilitiesSetEvent.printer = printer; |
| 788 privetCapabilitiesSetEvent.capabilities = capabilities; | 791 privetCapabilitiesSetEvent.capabilities = capabilities; |
| 789 this.dispatchEvent(privetCapabilitiesSetEvent); | 792 this.eventTarget_.dispatchEvent(privetCapabilitiesSetEvent); |
| 790 }, | 793 }, |
| 791 | 794 |
| 792 /** | 795 /** |
| 793 * @param {string} http_error The HTTP response code or -1 if not an HTTP | 796 * @param {string} http_error The HTTP response code or -1 if not an HTTP |
| 794 * error. | 797 * error. |
| 795 * @private | 798 * @private |
| 796 */ | 799 */ |
| 797 onPrivetPrintFailed_: function(http_error) { | 800 onPrivetPrintFailed_: function(http_error) { |
| 798 var privetPrintFailedEvent = | 801 var privetPrintFailedEvent = |
| 799 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); | 802 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); |
| 800 privetPrintFailedEvent.httpError = http_error; | 803 privetPrintFailedEvent.httpError = http_error; |
| 801 this.dispatchEvent(privetPrintFailedEvent); | 804 this.eventTarget_.dispatchEvent(privetPrintFailedEvent); |
| 802 }, | 805 }, |
| 803 | 806 |
| 804 /** | 807 /** |
| 805 * @param {Array<!{extensionId: string, | 808 * @param {Array<!{extensionId: string, |
| 806 * extensionName: string, | 809 * extensionName: string, |
| 807 * id: string, | 810 * id: string, |
| 808 * name: string, | 811 * name: string, |
| 809 * description: (string|undefined), | 812 * description: (string|undefined), |
| 810 * provisional: (boolean|undefined)}>} printers The list | 813 * provisional: (boolean|undefined)}>} printers The list |
| 811 * containing information about printers added by an extension. | 814 * containing information about printers added by an extension. |
| 812 * @param {boolean} done Whether this is the final list of extension | 815 * @param {boolean} done Whether this is the final list of extension |
| 813 * managed printers. | 816 * managed printers. |
| 814 */ | 817 */ |
| 815 onExtensionPrintersAdded_: function(printers, done) { | 818 onExtensionPrintersAdded_: function(printers, done) { |
| 816 var event = new Event(NativeLayer.EventType.EXTENSION_PRINTERS_ADDED); | 819 var event = new Event(NativeLayer.EventType.EXTENSION_PRINTERS_ADDED); |
| 817 event.printers = printers; | 820 event.printers = printers; |
| 818 event.done = done; | 821 event.done = done; |
| 819 this.dispatchEvent(event); | 822 this.eventTarget_.dispatchEvent(event); |
| 820 }, | 823 }, |
| 821 | 824 |
| 822 /** | 825 /** |
| 823 * Called when an extension responds to a request for an extension printer | 826 * Called when an extension responds to a request for an extension printer |
| 824 * capabilities. | 827 * capabilities. |
| 825 * @param {string} printerId The printer's ID. | 828 * @param {string} printerId The printer's ID. |
| 826 * @param {!Object} capabilities The reported printer capabilities. | 829 * @param {!Object} capabilities The reported printer capabilities. |
| 827 */ | 830 */ |
| 828 onExtensionCapabilitiesSet_: function(printerId, | 831 onExtensionCapabilitiesSet_: function(printerId, |
| 829 capabilities) { | 832 capabilities) { |
| 830 var event = new Event(NativeLayer.EventType.EXTENSION_CAPABILITIES_SET); | 833 var event = new Event(NativeLayer.EventType.EXTENSION_CAPABILITIES_SET); |
| 831 event.printerId = printerId; | 834 event.printerId = printerId; |
| 832 event.capabilities = capabilities; | 835 event.capabilities = capabilities; |
| 833 this.dispatchEvent(event); | 836 this.eventTarget_.dispatchEvent(event); |
| 834 }, | 837 }, |
| 835 | 838 |
| 836 /** | 839 /** |
| 837 * Called when Chrome reports that attempt to resolve a provisional | 840 * Called when Chrome reports that attempt to resolve a provisional |
| 838 * destination failed. | 841 * destination failed. |
| 839 * @param {string} destinationId The provisional destination ID. | 842 * @param {string} destinationId The provisional destination ID. |
| 840 * @private | 843 * @private |
| 841 */ | 844 */ |
| 842 failedToResolveProvisionalDestination_: function(destinationId) { | 845 failedToResolveProvisionalDestination_: function(destinationId) { |
| 843 var evt = new Event( | 846 var evt = new Event( |
| 844 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); | 847 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); |
| 845 evt.provisionalId = destinationId; | 848 evt.provisionalId = destinationId; |
| 846 evt.destination = null; | 849 evt.destination = null; |
| 847 this.dispatchEvent(evt); | 850 this.eventTarget_.dispatchEvent(evt); |
| 848 }, | 851 }, |
| 849 | 852 |
| 850 /** | 853 /** |
| 851 * Called when Chrome reports that a provisional destination has been | 854 * Called when Chrome reports that a provisional destination has been |
| 852 * successfully resolved. | 855 * successfully resolved. |
| 853 * Currently used only for extension provided destinations. | 856 * Currently used only for extension provided destinations. |
| 854 * @param {string} provisionalDestinationId The provisional destination id. | 857 * @param {string} provisionalDestinationId The provisional destination id. |
| 855 * @param {!{extensionId: string, | 858 * @param {!{extensionId: string, |
| 856 * extensionName: string, | 859 * extensionName: string, |
| 857 * id: string, | 860 * id: string, |
| 858 * name: string, | 861 * name: string, |
| 859 * description: (string|undefined)}} destinationInfo The resolved | 862 * description: (string|undefined)}} destinationInfo The resolved |
| 860 * destination info. | 863 * destination info. |
| 861 * @private | 864 * @private |
| 862 */ | 865 */ |
| 863 onProvisionalDestinationResolved_: function(provisionalDestinationId, | 866 onProvisionalDestinationResolved_: function(provisionalDestinationId, |
| 864 destinationInfo) { | 867 destinationInfo) { |
| 865 var evt = new Event( | 868 var evt = new Event( |
| 866 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); | 869 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); |
| 867 evt.provisionalId = provisionalDestinationId; | 870 evt.provisionalId = provisionalDestinationId; |
| 868 evt.destination = destinationInfo; | 871 evt.destination = destinationInfo; |
| 869 this.dispatchEvent(evt); | 872 this.eventTarget_.dispatchEvent(evt); |
| 870 }, | 873 }, |
| 871 | 874 |
| 872 /** | 875 /** |
| 873 * Allows for onManipulateSettings to be called | 876 * Allows for onManipulateSettings to be called |
| 874 * from the native layer. | 877 * from the native layer. |
| 875 * @private | 878 * @private |
| 876 */ | 879 */ |
| 877 onEnableManipulateSettingsForTest_: function() { | 880 onEnableManipulateSettingsForTest_: function() { |
| 878 global.onManipulateSettingsForTest = | 881 global.onManipulateSettingsForTest = |
| 879 this.onManipulateSettingsForTest_.bind(this); | 882 this.onManipulateSettingsForTest_.bind(this); |
| 880 }, | 883 }, |
| 881 | 884 |
| 882 /** | 885 /** |
| 883 * Dispatches an event to print_preview.js to change | 886 * Dispatches an event to print_preview.js to change |
| 884 * a particular setting for print preview. | 887 * a particular setting for print preview. |
| 885 * @param {!print_preview.PreviewSettings} settings Object containing the | 888 * @param {!print_preview.PreviewSettings} settings Object containing the |
| 886 * value to be changed and that value should be set to. | 889 * value to be changed and that value should be set to. |
| 887 * @private | 890 * @private |
| 888 */ | 891 */ |
| 889 onManipulateSettingsForTest_: function(settings) { | 892 onManipulateSettingsForTest_: function(settings) { |
| 890 var manipulateSettingsEvent = | 893 var manipulateSettingsEvent = |
| 891 new Event(NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST); | 894 new Event(NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST); |
| 892 manipulateSettingsEvent.settings = settings; | 895 manipulateSettingsEvent.settings = settings; |
| 893 this.dispatchEvent(manipulateSettingsEvent); | 896 this.eventTarget_.dispatchEvent(manipulateSettingsEvent); |
| 894 }, | 897 }, |
| 895 | 898 |
| 896 /** | 899 /** |
| 897 * Sends a message to the test, letting it know that an | 900 * Sends a message to the test, letting it know that an |
| 898 * option has been set to a particular value and that the change has | 901 * option has been set to a particular value and that the change has |
| 899 * finished modifying the preview area. | 902 * finished modifying the preview area. |
| 900 */ | 903 */ |
| 901 previewReadyForTest: function() { | 904 previewReadyForTest: function() { |
| 902 if (global.onManipulateSettingsForTest) | 905 if (global.onManipulateSettingsForTest) |
| 903 chrome.send('UILoadedForTest'); | 906 chrome.send('UILoadedForTest'); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 return this.serializedDefaultDestinationSelectionRulesStr_; | 1097 return this.serializedDefaultDestinationSelectionRulesStr_; |
| 1095 } | 1098 } |
| 1096 }; | 1099 }; |
| 1097 | 1100 |
| 1098 // Export | 1101 // Export |
| 1099 return { | 1102 return { |
| 1100 NativeInitialSettings: NativeInitialSettings, | 1103 NativeInitialSettings: NativeInitialSettings, |
| 1101 NativeLayer: NativeLayer | 1104 NativeLayer: NativeLayer |
| 1102 }; | 1105 }; |
| 1103 }); | 1106 }); |
| OLD | NEW |