| Index: chrome/browser/resources/print_preview/print_preview.js
|
| ===================================================================
|
| --- chrome/browser/resources/print_preview/print_preview.js (revision 104536)
|
| +++ chrome/browser/resources/print_preview/print_preview.js (working copy)
|
| @@ -536,7 +536,7 @@
|
| */
|
| function setDefaultPrinter(printer_name, cloudPrintData) {
|
| // Add a placeholder value so the printer list looks valid.
|
| - addDestinationListOption('', '', true, true, true);
|
| + addDestinationListOption('', '', true, true);
|
| if (printer_name) {
|
| defaultOrLastUsedPrinterName = printer_name;
|
| if (cloudPrintData) {
|
| @@ -565,38 +565,36 @@
|
| for (var i = 0; i < printers.length; ++i) {
|
| var isDefault = (printers[i].deviceName == defaultOrLastUsedPrinterName);
|
| addDestinationListOption(printers[i].printerName, printers[i].deviceName,
|
| - isDefault, false, false);
|
| + isDefault, false);
|
| }
|
|
|
| if (printers.length != 0)
|
| - addDestinationListOption('', '', false, true, true);
|
| + addDestinationListSeparator();
|
|
|
| // Adding option for saving PDF to disk.
|
| addDestinationListOption(localStrings.getString('printToPDF'),
|
| PRINT_TO_PDF,
|
| defaultOrLastUsedPrinterName == PRINT_TO_PDF,
|
| - false,
|
| false);
|
| - addDestinationListOption('', '', false, true, true);
|
| + addDestinationListSeparator();
|
| if (useCloudPrint) {
|
| addDestinationListOption(localStrings.getString('printWithCloudPrint'),
|
| PRINT_WITH_CLOUD_PRINT,
|
| false,
|
| - false,
|
| false);
|
| - addDestinationListOption('', '', false, true, true);
|
| + addDestinationListSeparator();
|
| }
|
| // Add options to manage printers.
|
| if (!cr.isChromeOS) {
|
| addDestinationListOption(localStrings.getString('managePrinters'),
|
| - MANAGE_LOCAL_PRINTERS, false, false, false);
|
| + MANAGE_LOCAL_PRINTERS, false, false);
|
| } else if (useCloudPrint) {
|
| // Fetch recent printers.
|
| cloudprint.fetchPrinters(addDestinationListOptionAtPosition, false);
|
| // Fetch the full printer list.
|
| cloudprint.fetchPrinters(addDestinationListOptionAtPosition, true);
|
| addDestinationListOption(localStrings.getString('managePrinters'),
|
| - MANAGE_CLOUD_PRINTERS, false, false, false);
|
| + MANAGE_CLOUD_PRINTERS, false, false);
|
| }
|
|
|
| printerList.disabled = false;
|
| @@ -611,20 +609,15 @@
|
| * @param {string} optionValue specifies the option value.
|
| * @param {boolean} isDefault is true if the option needs to be selected.
|
| * @param {boolean} isDisabled is true if the option needs to be disabled.
|
| - * @param {boolean} isSeparator is true if the option is a visual separator and
|
| - * needs to be disabled.
|
| * @return {Object} The created option.
|
| */
|
| function createDestinationListOption(optionText, optionValue, isDefault,
|
| - isDisabled, isSeparator) {
|
| + isDisabled) {
|
| var option = document.createElement('option');
|
| option.textContent = optionText;
|
| option.value = optionValue;
|
| option.selected = isDefault;
|
| - option.disabled = isSeparator || isDisabled;
|
| - // Adding attribute for improved accessibility.
|
| - if (isSeparator)
|
| - option.setAttribute("role", "separator");
|
| + option.disabled = isDisabled;
|
| return option;
|
| }
|
|
|
| @@ -637,12 +630,11 @@
|
| * @return {Object} The created option.
|
| */
|
| function addDestinationListOption(optionText, optionValue, isDefault,
|
| - isDisabled, isSeparator) {
|
| + isDisabled) {
|
| var option = createDestinationListOption(optionText,
|
| optionValue,
|
| isDefault,
|
| - isDisabled,
|
| - isSeparator);
|
| + isDisabled);
|
| $('printer-list').add(option);
|
| return option;
|
| }
|
| @@ -661,19 +653,25 @@
|
| optionText,
|
| optionValue,
|
| isDefault,
|
| - isDisabled,
|
| - isSeparator) {
|
| + isDisabled) {
|
| var option = createDestinationListOption(optionText,
|
| optionValue,
|
| isDefault,
|
| - isDisabled,
|
| - isSeparator);
|
| + isDisabled);
|
| var printerList = $('printer-list');
|
| var before = printerList[position];
|
| printerList.add(option, before);
|
| return option;
|
| }
|
| +
|
| /**
|
| + * Adds a separator to the printer destination list.
|
| + */
|
| +function addDestinationListSeparator() {
|
| + $('printer-list').add(document.createElement('hr'));
|
| +}
|
| +
|
| +/**
|
| * Sets the color mode for the PDF plugin.
|
| * Called from PrintPreviewHandler::ProcessColorSetting().
|
| * @param {boolean} color is true if the PDF plugin should display in color.
|
|
|