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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 onDidGetPreviewPageCount_: function(pageCount, previewResponseId) { | 539 onDidGetPreviewPageCount_: function(pageCount, previewResponseId) { |
540 var pageCountChangeEvent = new cr.Event( | 540 var pageCountChangeEvent = new cr.Event( |
541 NativeLayer.EventType.PAGE_COUNT_READY); | 541 NativeLayer.EventType.PAGE_COUNT_READY); |
542 pageCountChangeEvent.pageCount = pageCount; | 542 pageCountChangeEvent.pageCount = pageCount; |
543 pageCountChangeEvent.previewResponseId = previewResponseId; | 543 pageCountChangeEvent.previewResponseId = previewResponseId; |
544 this.dispatchEvent(pageCountChangeEvent); | 544 this.dispatchEvent(pageCountChangeEvent); |
545 }, | 545 }, |
546 | 546 |
547 /** | 547 /** |
548 * Called when no pipelining previewed pages. | 548 * Called when no pipelining previewed pages. |
549 * @param {string} previewUid Preview unique identifier. | 549 * @param {number} previewUid Preview unique identifier. |
550 * @param {number} previewResponseId The preview request id that resulted in | 550 * @param {number} previewResponseId The preview request id that resulted in |
551 * this response. | 551 * this response. |
552 * @private | 552 * @private |
553 */ | 553 */ |
554 onReloadPreviewPages_: function(previewUid, previewResponseId) { | 554 onReloadPreviewPages_: function(previewUid, previewResponseId) { |
555 var previewReloadEvent = new cr.Event( | 555 var previewReloadEvent = new cr.Event( |
556 NativeLayer.EventType.PREVIEW_RELOAD); | 556 NativeLayer.EventType.PREVIEW_RELOAD); |
557 previewReloadEvent.previewUid = previewUid; | 557 previewReloadEvent.previewUid = previewUid; |
558 previewReloadEvent.previewResponseId = previewResponseId; | 558 previewReloadEvent.previewResponseId = previewResponseId; |
559 this.dispatchEvent(previewReloadEvent); | 559 this.dispatchEvent(previewReloadEvent); |
560 }, | 560 }, |
561 | 561 |
562 /** | 562 /** |
563 * Notification that a print preview page has been rendered. | 563 * Notification that a print preview page has been rendered. |
564 * Check if the settings have changed and request a regeneration if needed. | 564 * Check if the settings have changed and request a regeneration if needed. |
565 * Called from PrintPreviewUI::OnDidPreviewPage(). | 565 * Called from PrintPreviewUI::OnDidPreviewPage(). |
566 * @param {number} pageNumber The page number, 0-based. | 566 * @param {number} pageNumber The page number, 0-based. |
567 * @param {string} previewUid Preview unique identifier. | 567 * @param {number} previewUid Preview unique identifier. |
568 * @param {number} previewResponseId The preview request id that resulted in | 568 * @param {number} previewResponseId The preview request id that resulted in |
569 * this response. | 569 * this response. |
570 * @private | 570 * @private |
571 */ | 571 */ |
572 onDidPreviewPage_: function(pageNumber, previewUid, previewResponseId) { | 572 onDidPreviewPage_: function(pageNumber, previewUid, previewResponseId) { |
573 var pagePreviewGenEvent = new cr.Event( | 573 var pagePreviewGenEvent = new cr.Event( |
574 NativeLayer.EventType.PAGE_PREVIEW_READY); | 574 NativeLayer.EventType.PAGE_PREVIEW_READY); |
575 pagePreviewGenEvent.pageIndex = pageNumber; | 575 pagePreviewGenEvent.pageIndex = pageNumber; |
576 pagePreviewGenEvent.previewUid = previewUid; | 576 pagePreviewGenEvent.previewUid = previewUid; |
577 pagePreviewGenEvent.previewResponseId = previewResponseId; | 577 pagePreviewGenEvent.previewResponseId = previewResponseId; |
578 this.dispatchEvent(pagePreviewGenEvent); | 578 this.dispatchEvent(pagePreviewGenEvent); |
579 }, | 579 }, |
580 | 580 |
581 /** | 581 /** |
582 * Update the print preview when new preview data is available. | 582 * Update the print preview when new preview data is available. |
583 * Create the PDF plugin as needed. | 583 * Create the PDF plugin as needed. |
584 * Called from PrintPreviewUI::PreviewDataIsAvailable(). | 584 * Called from PrintPreviewUI::PreviewDataIsAvailable(). |
585 * @param {string} previewUid Preview unique identifier. | 585 * @param {number} previewUid Preview unique identifier. |
586 * @param {number} previewResponseId The preview request id that resulted in | 586 * @param {number} previewResponseId The preview request id that resulted in |
587 * this response. | 587 * this response. |
588 * @private | 588 * @private |
589 */ | 589 */ |
590 onUpdatePrintPreview_: function(previewUid, previewResponseId) { | 590 onUpdatePrintPreview_: function(previewUid, previewResponseId) { |
591 var previewGenDoneEvent = new cr.Event( | 591 var previewGenDoneEvent = new cr.Event( |
592 NativeLayer.EventType.PREVIEW_GENERATION_DONE); | 592 NativeLayer.EventType.PREVIEW_GENERATION_DONE); |
593 previewGenDoneEvent.previewUid = previewUid; | 593 previewGenDoneEvent.previewUid = previewUid; |
594 previewGenDoneEvent.previewResponseId = previewResponseId; | 594 previewGenDoneEvent.previewResponseId = previewResponseId; |
595 this.dispatchEvent(previewGenDoneEvent); | 595 this.dispatchEvent(previewGenDoneEvent); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 return this.isLocalDestination_; | 799 return this.isLocalDestination_; |
800 } | 800 } |
801 }; | 801 }; |
802 | 802 |
803 // Export | 803 // Export |
804 return { | 804 return { |
805 NativeInitialSettings: NativeInitialSettings, | 805 NativeInitialSettings: NativeInitialSettings, |
806 NativeLayer: NativeLayer | 806 NativeLayer: NativeLayer |
807 }; | 807 }; |
808 }); | 808 }); |
OLD | NEW |