Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 10450022: Print Preview Print Destination Search Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Set --bary flag Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 'previewModifiable': printTicketStore.isDocumentModifiable, 225 'previewModifiable': printTicketStore.isDocumentModifiable,
226 'printToPDF': destination.id == 226 'printToPDF': destination.id ==
227 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, 227 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
228 'printWithCloudPrint': !destination.isLocal, 228 'printWithCloudPrint': !destination.isLocal,
229 'deviceName': destination.id, 229 'deviceName': destination.id,
230 'isFirstRequest': false, 230 'isFirstRequest': false,
231 'requestID': -1, 231 'requestID': -1,
232 'fitToPageEnabled': printTicketStore.isFitToPageEnabled() 232 'fitToPageEnabled': printTicketStore.isFitToPageEnabled()
233 }; 233 };
234 234
235 if (!destination.isLocal && !destination.isPrintWithCloudPrint) { 235 if (!destination.isLocal) {
236 // We can't set cloudPrintID if the destination is "Print with Cloud 236 // We can't set cloudPrintID if the destination is "Print with Cloud
237 // Print" because the native system will try to print to Google Cloud 237 // Print" because the native system will try to print to Google Cloud
238 // Print with this ID instead of opening a Google Cloud Print dialog. 238 // Print with this ID instead of opening a Google Cloud Print dialog.
239 ticket['cloudPrintID'] = destination.id; 239 ticket['cloudPrintID'] = destination.id;
240 } 240 }
241 241
242 if (printTicketStore.hasMarginsCapability() && 242 if (printTicketStore.hasMarginsCapability() &&
243 printTicketStore.getMarginsType() == 243 printTicketStore.getMarginsType() ==
244 print_preview.ticket_items.MarginsType.Value.CUSTOM) { 244 print_preview.ticket_items.MarginsType.Value.CUSTOM) {
245 var customMargins = printTicketStore.getCustomMargins(); 245 var customMargins = printTicketStore.getCustomMargins();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 /** 294 /**
295 * Opens the Google Cloud Print sign-in dialog. The DESTINATIONS_RELOAD 295 * Opens the Google Cloud Print sign-in dialog. The DESTINATIONS_RELOAD
296 * event will be dispatched in response. 296 * event will be dispatched in response.
297 */ 297 */
298 startCloudPrintSignIn: function() { 298 startCloudPrintSignIn: function() {
299 chrome.send('signIn'); 299 chrome.send('signIn');
300 }, 300 },
301 301
302 /** Navigates the user to the system printer settings interface. */ 302 /** Navigates the user to the system printer settings interface. */
303 startManageLocalPrinters: function() { 303 startManageLocalDestinations: function() {
304 chrome.send('manageLocalPrinters'); 304 chrome.send('manageLocalPrinters');
305 }, 305 },
306 306
307 /** Navigates the user to the Google Cloud Print management page. */ 307 /** Navigates the user to the Google Cloud Print management page. */
308 startManageCloudPrinters: function() { 308 startManageCloudDestinations: function() {
309 chrome.send('manageCloudPrinters'); 309 chrome.send('manageCloudPrinters');
310 }, 310 },
311 311
312 /** 312 /**
313 * @param {object} initialSettings Object containing all initial settings. 313 * @param {!Object} initialSettings Object containing all initial settings.
314 */ 314 */
315 onSetInitialSettings_: function(initialSettings) { 315 onSetInitialSettings_: function(initialSettings) {
316 // TODO(rltoscano): Use initialSettings['cloudPrintData'] to prepopulate 316 // TODO(rltoscano): Use initialSettings['cloudPrintData'] to prepopulate
317 // destination and initial print ticket. 317 // destination and initial print ticket.
318 var numberFormatSymbols = 318 var numberFormatSymbols =
319 print_preview.MeasurementSystem.parseNumberFormat( 319 print_preview.MeasurementSystem.parseNumberFormat(
320 initialSettings['numberFormat']); 320 initialSettings['numberFormat']);
321 var unitType = print_preview.MeasurementSystem.UnitType.IMPERIAL; 321 var unitType = print_preview.MeasurementSystem.UnitType.IMPERIAL;
322 if (initialSettings['measurementSystem'] != null) { 322 if (initialSettings['measurementSystem'] != null) {
323 unitType = initialSettings['measurementSystem']; 323 unitType = initialSettings['measurementSystem'];
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 cr.dispatchSimpleEvent(this, NativeLayer.EventType.DISABLE_SCALING); 555 cr.dispatchSimpleEvent(this, NativeLayer.EventType.DISABLE_SCALING);
556 } 556 }
557 }; 557 };
558 558
559 /** 559 /**
560 * Initial settings retrieved from the native layer. 560 * Initial settings retrieved from the native layer.
561 * @param {boolean} isInKioskAutoPrintMode Whether the print preview should be 561 * @param {boolean} isInKioskAutoPrintMode Whether the print preview should be
562 * in auto-print mode. 562 * in auto-print mode.
563 * @param {string} thousandsDelimeter Character delimeter of thousands digits. 563 * @param {string} thousandsDelimeter Character delimeter of thousands digits.
564 * @param {string} decimalDelimeter Character delimeter of the decimal point. 564 * @param {string} decimalDelimeter Character delimeter of the decimal point.
565 * @param {print_preview.MeasurementSystem.UnitType} unitType Unit type of 565 * @param {!print_preview.MeasurementSystem.UnitType} unitType Unit type of
566 * local machine's measurement system. 566 * local machine's measurement system.
567 * @param {boolean} isDocumentModifiable Whether the document to print is 567 * @param {boolean} isDocumentModifiable Whether the document to print is
568 * modifiable. 568 * modifiable.
569 * @param {?print_preview.ticket_items.MarginsType.Value} marginsType Initial 569 * @param {print_preview.ticket_items.MarginsType.Value} marginsType Initial
570 * margins type. 570 * margins type.
571 * @param {print_preview.Margins} customMargins Initial custom margins. 571 * @param {print_preview.Margins} customMargins Initial custom margins.
572 * @param {boolean} isDuplexEnabled Whether duplexing is initially enabled. 572 * @param {boolean} isDuplexEnabled Whether duplexing is initially enabled.
573 * @param {boolean} isHeaderFooterEnabled Whether the header-footer is 573 * @param {boolean} isHeaderFooterEnabled Whether the header-footer is
574 * initially enabled. 574 * initially enabled.
575 * @param {?string} initialDestinationId ID of the destination to initially 575 * @param {?string} initialDestinationId ID of the destination to initially
576 * select. 576 * select.
577 * @constructor 577 * @constructor
578 */ 578 */
579 function NativeInitialSettings( 579 function NativeInitialSettings(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 618
619 /** 619 /**
620 * Whether the document to print is modifiable. 620 * Whether the document to print is modifiable.
621 * @type {boolean} 621 * @type {boolean}
622 * @private 622 * @private
623 */ 623 */
624 this.isDocumentModifiable_ = isDocumentModifiable; 624 this.isDocumentModifiable_ = isDocumentModifiable;
625 625
626 /** 626 /**
627 * Initial margins type. 627 * Initial margins type.
628 * @type {?print_preview.ticket_items.MarginsType.Value} 628 * @type {print_preview.ticket_items.MarginsType.Value}
629 * @private 629 * @private
630 */ 630 */
631 this.marginsType_ = marginsType; 631 this.marginsType_ = marginsType;
632 632
633 /** 633 /**
634 * Initial custom margins. 634 * Initial custom margins.
635 * @type {print_preview.Margins} 635 * @type {print_preview.Margins}
636 * @private 636 * @private
637 */ 637 */
638 this.customMargins_ = customMargins; 638 this.customMargins_ = customMargins;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 get thousandsDelimeter() { 671 get thousandsDelimeter() {
672 return this.thousandsDelimeter_; 672 return this.thousandsDelimeter_;
673 }, 673 },
674 674
675 /** @return {string} Character delimeter of the decimal point. */ 675 /** @return {string} Character delimeter of the decimal point. */
676 get decimalDelimeter() { 676 get decimalDelimeter() {
677 return this.decimalDelimeter_; 677 return this.decimalDelimeter_;
678 }, 678 },
679 679
680 /** 680 /**
681 * @return {print_preview.MeasurementSystem.UnitType} Unit type of local 681 * @return {!print_preview.MeasurementSystem.UnitType} Unit type of local
682 * machine's measurement system. 682 * machine's measurement system.
683 */ 683 */
684 get unitType() { 684 get unitType() {
685 return this.unitType_; 685 return this.unitType_;
686 }, 686 },
687 687
688 /** @return {boolean} Whether the document to print is modifiable. */ 688 /** @return {boolean} Whether the document to print is modifiable. */
689 get isDocumentModifiable() { 689 get isDocumentModifiable() {
690 return this.isDocumentModifiable_; 690 return this.isDocumentModifiable_;
691 }, 691 },
692 692
693 /** 693 /**
694 * @return {?print_preview.ticket_items.MarginsType.Value} Initial margins 694 * @return {print_preview.ticket_items.MarginsType.Value} Initial margins
695 * type or {@code null} if not initially set. 695 * type or {@code null} if not initially set.
696 */ 696 */
697 get marginsType() { 697 get marginsType() {
698 return this.marginsType_; 698 return this.marginsType_;
699 }, 699 },
700 700
701 /** @return {print_preview.Margins} Initial custom margins. */ 701 /** @return {print_preview.Margins} Initial custom margins. */
702 get customMargins() { 702 get customMargins() {
703 return this.customMargins_; 703 return this.customMargins_;
704 }, 704 },
(...skipping 13 matching lines...) Expand all
718 return this.initialDestinationId_; 718 return this.initialDestinationId_;
719 } 719 }
720 }; 720 };
721 721
722 // Export 722 // Export
723 return { 723 return {
724 NativeInitialSettings: NativeInitialSettings, 724 NativeInitialSettings: NativeInitialSettings,
725 NativeLayer: NativeLayer 725 NativeLayer: NativeLayer
726 }; 726 };
727 }); 727 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698