OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // require: cr/ui/print_preview_cloud.js | 5 // require: cr/ui/print_preview_cloud.js |
6 | 6 |
7 var localStrings = new LocalStrings(); | 7 var localStrings = new LocalStrings(); |
8 | 8 |
9 // If useCloudPrint is true we attempt to connect to cloud print | 9 // If useCloudPrint is true we attempt to connect to cloud print |
10 // and populate the list of printers with cloud print printers. | 10 // and populate the list of printers with cloud print printers. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 var copiesSettings; | 49 var copiesSettings; |
50 | 50 |
51 // Object holding all the layout related settings. | 51 // Object holding all the layout related settings. |
52 var layoutSettings; | 52 var layoutSettings; |
53 | 53 |
54 // True if the user has click 'Advanced...' in order to open the system print | 54 // True if the user has click 'Advanced...' in order to open the system print |
55 // dialog. | 55 // dialog. |
56 var showingSystemDialog = false; | 56 var showingSystemDialog = false; |
57 | 57 |
58 // The range of options in the printer dropdown controlled by cloud print. | 58 // The range of options in the printer dropdown controlled by cloud print. |
59 var firstCloudPrintOptionPos = 0 | 59 var firstCloudPrintOptionPos = 0; |
60 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; | 60 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; |
61 | 61 |
62 | |
63 // TODO(abodenha@chromium.org) A lot of cloud print specific logic has | |
64 // made its way into this file. Refactor to create a cleaner boundary | |
65 // between print preview and GCP code. Reference bug 88098 when fixing. | |
66 | |
67 // A dictionary of cloud printers that have been added to the printer | |
68 // dropdown. | |
69 var addedCloudPrinters = {}; | |
70 | |
71 // The maximum number of cloud printers to allow in the dropdown. | |
72 const maxCloudPrinters = 10; | |
73 | |
74 | |
62 /** | 75 /** |
63 * Window onload handler, sets up the page and starts print preview by getting | 76 * Window onload handler, sets up the page and starts print preview by getting |
64 * the printer list. | 77 * the printer list. |
65 */ | 78 */ |
66 function onLoad() { | 79 function onLoad() { |
67 cr.enablePlatformSpecificCSSRules(); | 80 cr.enablePlatformSpecificCSSRules(); |
68 | 81 |
69 $('cancel-button').addEventListener('click', handleCancelButtonClick); | 82 $('cancel-button').addEventListener('click', handleCancelButtonClick); |
70 | 83 |
71 if (!checkCompatiblePluginExists()) { | 84 if (!checkCompatiblePluginExists()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 if (cloudprint.isCloudPrint(printerList.options[selectedIndex])) { | 199 if (cloudprint.isCloudPrint(printerList.options[selectedIndex])) { |
187 updateWithCloudPrinterCapabilities(); | 200 updateWithCloudPrinterCapabilities(); |
188 skip_refresh = true; | 201 skip_refresh = true; |
189 } else if (selectedValue == SIGN_IN || | 202 } else if (selectedValue == SIGN_IN || |
190 selectedValue == MANAGE_CLOUD_PRINTERS || | 203 selectedValue == MANAGE_CLOUD_PRINTERS || |
191 selectedValue == MANAGE_LOCAL_PRINTERS || | 204 selectedValue == MANAGE_LOCAL_PRINTERS || |
192 selectedValue == ADD_CLOUD_PRINTER) { | 205 selectedValue == ADD_CLOUD_PRINTER) { |
193 printerList.selectedIndex = lastSelectedPrinterIndex; | 206 printerList.selectedIndex = lastSelectedPrinterIndex; |
194 chrome.send(selectedValue); | 207 chrome.send(selectedValue); |
195 skip_refresh = true; | 208 skip_refresh = true; |
209 } else if (selectedValue == MORE_PRINTERS) { | |
210 onSystemDialogLinkClicked(); | |
211 skip_refresh = true; | |
196 } else if (selectedValue == PRINT_TO_PDF) { | 212 } else if (selectedValue == PRINT_TO_PDF) { |
197 updateWithPrinterCapabilities({ | 213 updateWithPrinterCapabilities({ |
198 'disableColorOption': true, | 214 'disableColorOption': true, |
199 'setColorAsDefault': true, | 215 'setColorAsDefault': true, |
200 'setDuplexAsDefault': false, | 216 'setDuplexAsDefault': false, |
201 'disableCopiesOption': true}); | 217 'disableCopiesOption': true}); |
202 } else { | 218 } else { |
203 // This message will call back to 'updateWithPrinterCapabilities' | 219 // This message will call back to 'updateWithPrinterCapabilities' |
204 // function. | 220 // function. |
205 chrome.send('getPrinterCapabilities', [selectedValue]); | 221 chrome.send('getPrinterCapabilities', [selectedValue]); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 } | 349 } |
334 | 350 |
335 /** | 351 /** |
336 * @return {number} The next unused preview request id. | 352 * @return {number} The next unused preview request id. |
337 */ | 353 */ |
338 function generatePreviewRequestID() { | 354 function generatePreviewRequestID() { |
339 return ++lastPreviewRequestID; | 355 return ++lastPreviewRequestID; |
340 } | 356 } |
341 | 357 |
342 /** | 358 /** |
359 * @return {boolean} True iff a preview has been requested. | |
360 */ | |
361 function hasRequestedPreview() { | |
362 return lastPreviewRequestID > -1; | |
363 } | |
364 | |
365 /** | |
343 * Returns the name of the selected printer or the empty string if no | 366 * Returns the name of the selected printer or the empty string if no |
344 * printer is selected. | 367 * printer is selected. |
345 * @return {string} The name of the currently selected printer. | 368 * @return {string} The name of the currently selected printer. |
346 */ | 369 */ |
347 function getSelectedPrinterName() { | 370 function getSelectedPrinterName() { |
348 var printerList = $('printer-list') | 371 var printerList = $('printer-list') |
349 var selectedPrinter = printerList.selectedIndex; | 372 var selectedPrinter = printerList.selectedIndex; |
350 if (selectedPrinter < 0) | 373 if (selectedPrinter < 0) |
351 return ''; | 374 return ''; |
352 return printerList.options[selectedPrinter].value; | 375 return printerList.options[selectedPrinter].value; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 // TODO(thestig) re-enable controls here. | 462 // TODO(thestig) re-enable controls here. |
440 } | 463 } |
441 | 464 |
442 /** | 465 /** |
443 * Set the default printer. If there is one, generate a print preview. | 466 * Set the default printer. If there is one, generate a print preview. |
444 * @param {string} printer Name of the default printer. Empty if none. | 467 * @param {string} printer Name of the default printer. Empty if none. |
445 * @param {string} cloudPrintData Cloud print related data to restore if | 468 * @param {string} cloudPrintData Cloud print related data to restore if |
446 * the default printer is a cloud printer. | 469 * the default printer is a cloud printer. |
447 */ | 470 */ |
448 function setDefaultPrinter(printer_name, cloudPrintData) { | 471 function setDefaultPrinter(printer_name, cloudPrintData) { |
449 // Add a placeholder value so the printer list looks valid. | |
450 addDestinationListOption('', '', true, true, true); | |
451 if (printer_name) { | 472 if (printer_name) { |
452 defaultOrLastUsedPrinterName = printer_name; | 473 defaultOrLastUsedPrinterName = printer_name; |
453 if (cloudPrintData) { | 474 if (cloudPrintData) { |
454 cloudprint.setDefaultPrinter(printer_name, | 475 cloudprint.setDefaultPrinter(printer_name, |
455 cloudPrintData, | 476 cloudPrintData, |
456 addCloudPrinters, | 477 addCloudPrinters, |
457 doUpdateCloudPrinterCapabilities); | 478 doUpdateCloudPrinterCapabilities); |
458 } else { | 479 } else { |
459 $('printer-list')[0].value = defaultOrLastUsedPrinterName; | 480 addDestinationListOption('', |
481 defaultOrLastUsedPrinterName, | |
482 true, | |
483 true, | |
484 true); | |
460 updateControlsWithSelectedPrinterCapabilities(); | 485 updateControlsWithSelectedPrinterCapabilities(); |
461 } | 486 } |
462 } | 487 } |
463 chrome.send('getPrinters'); | 488 chrome.send('getPrinters'); |
464 } | 489 } |
465 | 490 |
466 /** | 491 /** |
467 * Fill the printer list drop down. | 492 * Fill the printer list drop down. |
468 * Called from PrintPreviewHandler::SendPrinterList(). | 493 * Called from PrintPreviewHandler::SendPrinterList(). |
469 * @param {Array} printers Array of printer info objects. | 494 * @param {Array} printers Array of printer info objects. |
470 */ | 495 */ |
471 function setPrinters(printers) { | 496 function setPrinters(printers) { |
472 var printerList = $('printer-list'); | |
473 // If there exists a dummy printer value, then setDefaultPrinter() already | |
474 // requested a preview, so no need to do it again. | |
475 var needPreview = (printerList[0].value == ''); | |
476 for (var i = 0; i < printers.length; ++i) { | 497 for (var i = 0; i < printers.length; ++i) { |
477 var isDefault = (printers[i].deviceName == defaultOrLastUsedPrinterName); | 498 var isDefault = (printers[i].deviceName == defaultOrLastUsedPrinterName); |
478 addDestinationListOption(printers[i].printerName, printers[i].deviceName, | 499 addDestinationListOption(printers[i].printerName, printers[i].deviceName, |
479 isDefault, false, false); | 500 isDefault, false, false); |
480 } | 501 } |
481 | 502 |
482 if (!cloudprint.isCloudPrint(printerList[0])) | |
483 // Remove the dummy printer added in setDefaultPrinter(). | |
484 printerList.remove(0); | |
485 | |
486 if (printers.length != 0) | 503 if (printers.length != 0) |
487 addDestinationListOption('', '', false, true, true); | 504 addDestinationListOption('', '', false, true, true); |
488 | 505 |
489 // Adding option for saving PDF to disk. | 506 // Adding option for saving PDF to disk. |
490 addDestinationListOption(localStrings.getString('printToPDF'), | 507 addDestinationListOption(localStrings.getString('printToPDF'), |
491 PRINT_TO_PDF, | 508 PRINT_TO_PDF, |
492 defaultOrLastUsedPrinterName == PRINT_TO_PDF, | 509 defaultOrLastUsedPrinterName == PRINT_TO_PDF, |
493 false, | 510 false, |
494 false); | 511 false); |
495 addDestinationListOption('', '', false, true, true); | 512 addDestinationListOption('', '', false, true, true); |
496 | 513 |
497 // Add options to manage printers. | 514 // Add options to manage printers. |
498 if (!cr.isChromeOS) { | 515 if (!cr.isChromeOS) { |
499 addDestinationListOption(localStrings.getString('manageLocalPrinters'), | 516 addDestinationListOption(localStrings.getString('manageLocalPrinters'), |
500 MANAGE_LOCAL_PRINTERS, false, false, false); | 517 MANAGE_LOCAL_PRINTERS, false, false, false); |
501 } | 518 } |
502 if (useCloudPrint) { | 519 if (useCloudPrint) { |
520 // Fetch recent printers. | |
503 cloudprint.fetchPrinters(addCloudPrinters, false); | 521 cloudprint.fetchPrinters(addCloudPrinters, false); |
522 // Fetch the full printer list. | |
523 cloudprint.fetchPrinters(addCloudPrinters, true); | |
504 addDestinationListOption(localStrings.getString('manageCloudPrinters'), | 524 addDestinationListOption(localStrings.getString('manageCloudPrinters'), |
505 MANAGE_CLOUD_PRINTERS, false, false, false); | 525 MANAGE_CLOUD_PRINTERS, false, false, false); |
506 } | 526 } |
507 | 527 |
508 printerList.disabled = false; | 528 $('printer-list').disabled = false; |
509 | 529 |
510 if (needPreview) | 530 if (!hasRequestedPreview()) |
511 updateControlsWithSelectedPrinterCapabilities(); | 531 updateControlsWithSelectedPrinterCapabilities(); |
512 } | 532 } |
513 | 533 |
514 /** | 534 /** |
515 * Creates an option that can be added to the printer destination list. | 535 * Creates an option that can be added to the printer destination list. |
516 * @param {String} optionText specifies the option text content. | 536 * @param {string} optionText specifies the option text content. |
517 * @param {String} optionValue specifies the option value. | 537 * @param {string} optionValue specifies the option value. |
518 * @param {boolean} isDefault is true if the option needs to be selected. | 538 * @param {boolean} isDefault is true if the option needs to be selected. |
519 * @param {boolean} isDisabled is true if the option needs to be disabled. | 539 * @param {boolean} isDisabled is true if the option needs to be disabled. |
520 * @param {boolean} isSeparator is true if the option is a visual separator and | 540 * @param {boolean} isSeparator is true if the option is a visual separator and |
521 * needs to be disabled. | 541 * needs to be disabled. |
522 * @return {Object} The created option. | 542 * @return {Object} The created option. |
523 */ | 543 */ |
524 function createDestinationListOption(optionText, optionValue, isDefault, | 544 function createDestinationListOption(optionText, optionValue, isDefault, |
525 isDisabled, isSeparator) { | 545 isDisabled, isSeparator) { |
526 var option = document.createElement('option'); | 546 var option = document.createElement('option'); |
527 option.textContent = optionText; | 547 option.textContent = optionText; |
528 option.value = optionValue; | 548 option.value = optionValue; |
529 option.selected = isDefault; | 549 option.selected = isDefault; |
530 option.disabled = isSeparator || isDisabled; | 550 option.disabled = isSeparator || isDisabled; |
531 // Adding attribute for improved accessibility. | 551 // Adding attribute for improved accessibility. |
532 if (isSeparator) | 552 if (isSeparator) |
533 option.setAttribute("role", "separator"); | 553 option.setAttribute("role", "separator"); |
534 return option; | 554 return option; |
535 } | 555 } |
536 | 556 |
537 /** | 557 /** |
538 * Adds an option to the printer destination list. | 558 * Adds an option to the printer destination list. |
539 * @param {String} optionText specifies the option text content. | 559 * @param {string} optionText specifies the option text content. |
540 * @param {String} optionValue specifies the option value. | 560 * @param {string} optionValue specifies the option value. |
541 * @param {boolean} isDefault is true if the option needs to be selected. | 561 * @param {boolean} isDefault is true if the option needs to be selected. |
542 * @param {boolean} isDisabled is true if the option needs to be disabled. | 562 * @param {boolean} isDisabled is true if the option needs to be disabled. |
543 * @return {Object} The created option. | 563 * @return {Object} The created option. |
544 */ | 564 */ |
545 function addDestinationListOption(optionText, optionValue, isDefault, | 565 function addDestinationListOption(optionText, optionValue, isDefault, |
546 isDisabled, isSeparator) { | 566 isDisabled, isSeparator) { |
547 var option = createDestinationListOption(optionText, | 567 var option = createDestinationListOption(optionText, |
548 optionValue, | 568 optionValue, |
549 isDefault, | 569 isDefault, |
550 isDisabled, | 570 isDisabled, |
551 isSeparator); | 571 isSeparator); |
552 $('printer-list').add(option); | 572 $('printer-list').add(option); |
553 return option; | 573 return option; |
554 } | 574 } |
555 | 575 |
556 /** | 576 /** |
557 * Adds an option to the printer destination list at a specified position. | 577 * Adds an option to the printer destination list at a specified position. |
558 * @param {Integer} position The index in the printer-list wher the option | 578 * @param {number} position The index in the printer-list wher the option |
559 should be created. | 579 should be created. |
560 * @param {String} optionText specifies the option text content. | 580 * @param {string} optionText specifies the option text content. |
561 * @param {String} optionValue specifies the option value. | 581 * @param {string} optionValue specifies the option value. |
562 * @param {boolean} isDefault is true if the option needs to be selected. | 582 * @param {boolean} isDefault is true if the option needs to be selected. |
563 * @param {boolean} isDisabled is true if the option needs to be disabled. | 583 * @param {boolean} isDisabled is true if the option needs to be disabled. |
564 * @return {Object} The created option. | 584 * @return {Object} The created option. |
565 */ | 585 */ |
566 function addDestinationListOptionAtPosition(position, | 586 function addDestinationListOptionAtPosition(position, |
567 optionText, | 587 optionText, |
568 optionValue, | 588 optionValue, |
569 isDefault, | 589 isDefault, |
570 isDisabled, | 590 isDisabled, |
571 isSeparator) { | 591 isSeparator) { |
572 var option = createDestinationListOption(optionText, | 592 var option = createDestinationListOption(optionText, |
573 optionValue, | 593 optionValue, |
574 isDefault, | 594 isDefault, |
575 isDisabled, | 595 isDisabled, |
576 isSeparator); | 596 isSeparator); |
577 var printerList = $('printer-list'); | 597 var printerList = $('printer-list'); |
578 var before = printerList[position]; | 598 var before = printerList[position]; |
579 printerList.add(option, before); | 599 printerList.add(option, before); |
580 return option; | 600 return option; |
581 } | 601 } |
582 | 602 |
583 /** | 603 /** |
584 * Removes the list of cloud printers from the printer pull down. | 604 * Test if a particular cloud printer has already been added to the |
605 * printer dropdown. | |
606 * @param {string} id A unique value to track this printer. | |
607 * @return {boolean} Returns true if this id has previously | |
dpapad
2011/07/19 23:01:35
Nit: s/Returns true/True.
Albert Bodenhamer
2011/07/19 23:17:33
Done.
| |
608 * been passed to trackCloudPrinterAdded. | |
585 */ | 609 */ |
586 function clearCloudPrinters() { | 610 function cloudPrinterAlreadyAdded(id) { |
587 var printerList = $('printer-list'); | 611 return (addedCloudPrinters[id]); |
588 while (firstCloudPrintOptionPos < lastCloudPrintOptionPos) { | 612 } |
589 lastCloudPrintOptionPos--; | 613 |
590 printerList.remove(lastCloudPrintOptionPos); | 614 /** |
615 * Record that a cloud printer will added to the printer dropdown. | |
616 * @param {string} id A unique value to track this printer. | |
617 * @return {boolean} Returns false if adding this printer would exceed | |
dpapad
2011/07/19 23:01:35
Nit: s/Returns false/False
Albert Bodenhamer
2011/07/19 23:17:33
Done.
| |
618 * |maxCloudPrinters|. | |
619 */ | |
620 function trackCloudPrinterAdded(id) { | |
621 if (Object.keys(addedCloudPrinters).length < maxCloudPrinters) { | |
622 addedCloudPrinters[id] = true; | |
623 return true; | |
624 } else { | |
625 return false; | |
591 } | 626 } |
592 } | 627 } |
593 | 628 |
629 | |
594 /** | 630 /** |
595 * Add cloud printers to the list drop down. | 631 * Add cloud printers to the list drop down. |
596 * Called from the cloudprint object on receipt of printer information from the | 632 * Called from the cloudprint object on receipt of printer information from the |
597 * cloud print server. | 633 * cloud print server. |
598 * @param {Array} printers Array of printer info objects. | 634 * @param {Array} printers Array of printer info objects. |
599 * @return {Object} The currently selected printer. | 635 * @return {Object} The currently selected printer. |
600 */ | 636 */ |
601 function addCloudPrinters(printers, showMorePrintersOption) { | 637 function addCloudPrinters(printers) { |
602 // TODO(abodenha@chromium.org) Avoid removing printers from the list. | 638 var isFirstPass = false; |
603 // Instead search for duplicates and don't add printers that already exist | 639 var showMorePrintersOption = false; |
604 // in the list. | 640 |
605 clearCloudPrinters(); | 641 if (firstCloudPrintOptionPos == lastCloudPrintOptionPos) { |
606 addDestinationListOptionAtPosition( | 642 isFirstPass = true; |
607 lastCloudPrintOptionPos++, | 643 var option = addDestinationListOptionAtPosition( |
608 localStrings.getString('cloudPrinters'), | 644 lastCloudPrintOptionPos++, |
609 '', | 645 localStrings.getString('cloudPrinters'), |
610 false, | 646 'Label', |
611 true, | 647 false, |
612 false); | 648 true, |
649 false); | |
650 cloudprint.setCloudPrint(option, null, null); | |
651 } | |
613 if (printers != null) { | 652 if (printers != null) { |
614 if (printers.length == 0) { | 653 if (printers.length == 0) { |
615 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | 654 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, |
616 localStrings.getString('addCloudPrinter'), | 655 localStrings.getString('addCloudPrinter'), |
617 ADD_CLOUD_PRINTER, | 656 ADD_CLOUD_PRINTER, |
618 false, | 657 false, |
619 false, | 658 false, |
620 false); | 659 false); |
621 } else { | 660 } else { |
622 for (printer in printers) { | 661 for (var i = 0; i < printers.length; i++) { |
623 var option = addDestinationListOptionAtPosition( | 662 if (!cloudPrinterAlreadyAdded(printers[i]['id'])) { |
624 lastCloudPrintOptionPos++, | 663 var option = addDestinationListOptionAtPosition( |
625 printers[printer]['name'], | 664 lastCloudPrintOptionPos++, |
626 printers[printer]['id'], | 665 printers[i]['name'], |
627 printers[printer]['name'] == defaultOrLastUsedPrinterName, | 666 printers[i]['id'], |
628 false, | 667 printers[i]['name'] == defaultOrLastUsedPrinterName, |
629 false); | 668 false, |
630 cloudprint.setCloudPrint(option, | 669 false); |
631 printers[printer]['name'], | 670 cloudprint.setCloudPrint(option, |
632 printers[printer]['id']); | 671 printers[i]['name'], |
672 printers[i]['id']); | |
673 if (!trackCloudPrinterAdded(printers[i]['id'])) { | |
674 showMorePrintersOption = true; | |
675 break; | |
676 } | |
677 } | |
633 } | 678 } |
634 if (showMorePrintersOption) { | 679 if (showMorePrintersOption) { |
635 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | 680 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, |
636 '', | 681 '', |
637 '', | 682 '', |
638 false, | 683 false, |
639 true, | 684 true, |
640 true); | 685 true); |
641 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | 686 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, |
642 localStrings.getString('morePrinters'), | 687 localStrings.getString('morePrinters'), |
643 MORE_PRINTERS, false, false, false); | 688 MORE_PRINTERS, false, false, false); |
644 } | 689 } |
645 } | 690 } |
646 } else { | 691 } else { |
647 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | 692 if (!cloudPrinterAlreadyAdded(SIGN_IN)) { |
648 localStrings.getString('signIn'), | 693 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, |
649 SIGN_IN, | 694 localStrings.getString('signIn'), |
695 SIGN_IN, | |
696 false, | |
697 false, | |
698 false); | |
699 trackCloudPrinterAdded(SIGN_IN); | |
700 } | |
701 } | |
702 if (isFirstPass) { | |
703 addDestinationListOptionAtPosition(lastCloudPrintOptionPos, | |
704 '', | |
705 '', | |
650 false, | 706 false, |
707 true, | |
708 true); | |
709 addDestinationListOptionAtPosition(lastCloudPrintOptionPos + 1, | |
710 localStrings.getString('localPrinters'), | |
711 '', | |
651 false, | 712 false, |
713 true, | |
652 false); | 714 false); |
653 } | 715 } |
654 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | |
655 '', | |
656 '', | |
657 false, | |
658 true, | |
659 true); | |
660 addDestinationListOptionAtPosition(lastCloudPrintOptionPos++, | |
661 localStrings.getString('localPrinters'), | |
662 '', | |
663 false, | |
664 true, | |
665 false); | |
666 var printerList = $('printer-list') | 716 var printerList = $('printer-list') |
667 var selectedPrinter = printerList.selectedIndex; | 717 var selectedPrinter = printerList.selectedIndex; |
668 if (selectedPrinter < 0) | 718 if (selectedPrinter < 0) |
669 return null; | 719 return null; |
670 return printerList.options[selectedPrinter]; | 720 return printerList.options[selectedPrinter]; |
671 } | 721 } |
672 | 722 |
673 /** | 723 /** |
674 * Sets the color mode for the PDF plugin. | 724 * Sets the color mode for the PDF plugin. |
675 * Called from PrintPreviewHandler::ProcessColorSetting(). | 725 * Called from PrintPreviewHandler::ProcessColorSetting(). |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 } | 998 } |
949 | 999 |
950 /** | 1000 /** |
951 * Takes a snapshot of the print settings. | 1001 * Takes a snapshot of the print settings. |
952 */ | 1002 */ |
953 PrintSettings.prototype.save = function() { | 1003 PrintSettings.prototype.save = function() { |
954 this.deviceName = getSelectedPrinterName(); | 1004 this.deviceName = getSelectedPrinterName(); |
955 this.isLandscape = layoutSettings.isLandscape(); | 1005 this.isLandscape = layoutSettings.isLandscape(); |
956 } | 1006 } |
957 | 1007 |
OLD | NEW |