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 * An interface to the native Chromium printing system layer. | 9 * An interface to the native Chromium printing system layer. |
10 * @constructor | 10 * @constructor |
(...skipping 28 matching lines...) Expand all Loading... |
39 global['onDidPreviewPage'] = this.onDidPreviewPage_.bind(this); | 39 global['onDidPreviewPage'] = this.onDidPreviewPage_.bind(this); |
40 global['updatePrintPreview'] = this.onUpdatePrintPreview_.bind(this); | 40 global['updatePrintPreview'] = this.onUpdatePrintPreview_.bind(this); |
41 global['printScalingDisabledForSourcePDF'] = | 41 global['printScalingDisabledForSourcePDF'] = |
42 this.onPrintScalingDisabledForSourcePDF_.bind(this); | 42 this.onPrintScalingDisabledForSourcePDF_.bind(this); |
43 global['onDidGetAccessToken'] = this.onDidGetAccessToken_.bind(this); | 43 global['onDidGetAccessToken'] = this.onDidGetAccessToken_.bind(this); |
44 global['autoCancelForTesting'] = this.autoCancelForTesting_.bind(this); | 44 global['autoCancelForTesting'] = this.autoCancelForTesting_.bind(this); |
45 global['onPrivetPrinterChanged'] = this.onPrivetPrinterChanged_.bind(this); | 45 global['onPrivetPrinterChanged'] = this.onPrivetPrinterChanged_.bind(this); |
46 global['onPrivetCapabilitiesSet'] = | 46 global['onPrivetCapabilitiesSet'] = |
47 this.onPrivetCapabilitiesSet_.bind(this); | 47 this.onPrivetCapabilitiesSet_.bind(this); |
48 global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); | 48 global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); |
| 49 global['onClickStuff'] = this.onClickStuff_.bind(this); |
49 }; | 50 }; |
50 | 51 |
51 /** | 52 /** |
52 * Event types dispatched from the Chromium native layer. | 53 * Event types dispatched from the Chromium native layer. |
53 * @enum {string} | 54 * @enum {string} |
54 * @const | 55 * @const |
55 */ | 56 */ |
56 NativeLayer.EventType = { | 57 NativeLayer.EventType = { |
57 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', | 58 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', |
58 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', | 59 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', |
(...skipping 11 matching lines...) Expand all Loading... |
70 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', | 71 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', |
71 PREVIEW_GENERATION_DONE: | 72 PREVIEW_GENERATION_DONE: |
72 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', | 73 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', |
73 PREVIEW_GENERATION_FAIL: | 74 PREVIEW_GENERATION_FAIL: |
74 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', | 75 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', |
75 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', | 76 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', |
76 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', | 77 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', |
77 PRIVET_PRINTER_CHANGED: 'print_preview.NativeLayer.PRIVET_PRINTER_CHANGED', | 78 PRIVET_PRINTER_CHANGED: 'print_preview.NativeLayer.PRIVET_PRINTER_CHANGED', |
78 PRIVET_CAPABILITIES_SET: | 79 PRIVET_CAPABILITIES_SET: |
79 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', | 80 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', |
80 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED' | 81 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', |
| 82 CLICK_STUFF: 'print_preview.NativeLayer.CLICK_STUFF' |
81 }; | 83 }; |
82 | 84 |
83 /** | 85 /** |
84 * Constant values matching printing::DuplexMode enum. | 86 * Constant values matching printing::DuplexMode enum. |
85 * @enum {number} | 87 * @enum {number} |
86 */ | 88 */ |
87 NativeLayer.DuplexMode = { | 89 NativeLayer.DuplexMode = { |
88 SIMPLEX: 0, | 90 SIMPLEX: 0, |
89 LONG_EDGE: 1, | 91 LONG_EDGE: 1, |
90 UNKNOWN_DUPLEX_MODE: -1 | 92 UNKNOWN_DUPLEX_MODE: -1 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 /** | 667 /** |
666 * @param {string} http_error The HTTP response code or -1 if not an HTTP | 668 * @param {string} http_error The HTTP response code or -1 if not an HTTP |
667 * error. | 669 * error. |
668 * @private | 670 * @private |
669 */ | 671 */ |
670 onPrivetPrintFailed_: function(http_error) { | 672 onPrivetPrintFailed_: function(http_error) { |
671 var privetPrintFailedEvent = | 673 var privetPrintFailedEvent = |
672 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); | 674 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); |
673 privetPrintFailedEvent.httpError = http_error; | 675 privetPrintFailedEvent.httpError = http_error; |
674 this.dispatchEvent(privetPrintFailedEvent); | 676 this.dispatchEvent(privetPrintFailedEvent); |
| 677 }, |
| 678 |
| 679 /** |
| 680 * Function call from browsertest to start clicking certain buttons |
| 681 */ |
| 682 onClickStuff_: function() { |
| 683 var clickStuffEvent = |
| 684 new Event(NativeLayer.EventType.CLICK_STUFF); |
| 685 this.dispatchEvent(clickStuffEvent); |
675 } | 686 } |
676 }; | 687 }; |
677 | 688 |
678 /** | 689 /** |
679 * Initial settings retrieved from the native layer. | 690 * Initial settings retrieved from the native layer. |
680 * @param {boolean} isInKioskAutoPrintMode Whether the print preview should be | 691 * @param {boolean} isInKioskAutoPrintMode Whether the print preview should be |
681 * in auto-print mode. | 692 * in auto-print mode. |
682 * @param {string} thousandsDelimeter Character delimeter of thousands digits. | 693 * @param {string} thousandsDelimeter Character delimeter of thousands digits. |
683 * @param {string} decimalDelimeter Character delimeter of the decimal point. | 694 * @param {string} decimalDelimeter Character delimeter of the decimal point. |
684 * @param {!print_preview.MeasurementSystem.UnitType} unitType Unit type of | 695 * @param {!print_preview.MeasurementSystem.UnitType} unitType Unit type of |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 return this.serializedAppStateStr_; | 861 return this.serializedAppStateStr_; |
851 } | 862 } |
852 }; | 863 }; |
853 | 864 |
854 // Export | 865 // Export |
855 return { | 866 return { |
856 NativeInitialSettings: NativeInitialSettings, | 867 NativeInitialSettings: NativeInitialSettings, |
857 NativeLayer: NativeLayer | 868 NativeLayer: NativeLayer |
858 }; | 869 }; |
859 }); | 870 }); |
OLD | NEW |