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

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

Issue 8207005: [print preview] Improve appearance of select control separators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 529 }
530 530
531 /** 531 /**
532 * Set the default printer. If there is one, generate a print preview. 532 * Set the default printer. If there is one, generate a print preview.
533 * @param {string} printer Name of the default printer. Empty if none. 533 * @param {string} printer Name of the default printer. Empty if none.
534 * @param {string} cloudPrintData Cloud print related data to restore if 534 * @param {string} cloudPrintData Cloud print related data to restore if
535 * the default printer is a cloud printer. 535 * the default printer is a cloud printer.
536 */ 536 */
537 function setDefaultPrinter(printer_name, cloudPrintData) { 537 function setDefaultPrinter(printer_name, cloudPrintData) {
538 // Add a placeholder value so the printer list looks valid. 538 // Add a placeholder value so the printer list looks valid.
539 addDestinationListOption('', '', true, true, true); 539 addDestinationListOption('', '', true, true, false);
kmadhusu 2011/10/07 22:11:26 dpapad: I am not sure why we have a placeholder he
dpapad 2011/10/10 21:54:27 Briefly spoke with thestig about why we have this
540 if (printer_name) { 540 if (printer_name) {
541 defaultOrLastUsedPrinterName = printer_name; 541 defaultOrLastUsedPrinterName = printer_name;
542 if (cloudPrintData) { 542 if (cloudPrintData) {
543 cloudprint.setDefaultPrinter(printer_name, 543 cloudprint.setDefaultPrinter(printer_name,
544 cloudPrintData, 544 cloudPrintData,
545 addDestinationListOptionAtPosition, 545 addDestinationListOptionAtPosition,
546 doUpdateCloudPrinterCapabilities); 546 doUpdateCloudPrinterCapabilities);
547 } else { 547 } else {
548 $('printer-list')[0].value = defaultOrLastUsedPrinterName; 548 $('printer-list')[0].value = defaultOrLastUsedPrinterName;
549 updateControlsWithSelectedPrinterCapabilities(); 549 updateControlsWithSelectedPrinterCapabilities();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 * @param {string} optionText specifies the option text content. 610 * @param {string} optionText specifies the option text content.
611 * @param {string} optionValue specifies the option value. 611 * @param {string} optionValue specifies the option value.
612 * @param {boolean} isDefault is true if the option needs to be selected. 612 * @param {boolean} isDefault is true if the option needs to be selected.
613 * @param {boolean} isDisabled is true if the option needs to be disabled. 613 * @param {boolean} isDisabled is true if the option needs to be disabled.
614 * @param {boolean} isSeparator is true if the option is a visual separator and 614 * @param {boolean} isSeparator is true if the option is a visual separator and
615 * needs to be disabled. 615 * needs to be disabled.
616 * @return {Object} The created option. 616 * @return {Object} The created option.
617 */ 617 */
618 function createDestinationListOption(optionText, optionValue, isDefault, 618 function createDestinationListOption(optionText, optionValue, isDefault,
619 isDisabled, isSeparator) { 619 isDisabled, isSeparator) {
620 if (isSeparator)
621 return document.createElement('hr');
kmadhusu 2011/10/07 22:11:26 Can you move lines 620 and 621 to a separate funct
csilv 2011/10/07 22:40:34 Done.
622
620 var option = document.createElement('option'); 623 var option = document.createElement('option');
621 option.textContent = optionText; 624 option.textContent = optionText;
622 option.value = optionValue; 625 option.value = optionValue;
623 option.selected = isDefault; 626 option.selected = isDefault;
624 option.disabled = isSeparator || isDisabled; 627 option.disabled = isDisabled;
625 // Adding attribute for improved accessibility.
626 if (isSeparator)
627 option.setAttribute("role", "separator");
628 return option; 628 return option;
629 } 629 }
630 630
631 /** 631 /**
632 * Adds an option to the printer destination list. 632 * Adds an option to the printer destination list.
633 * @param {string} optionText specifies the option text content. 633 * @param {string} optionText specifies the option text content.
634 * @param {string} optionValue specifies the option value. 634 * @param {string} optionValue specifies the option value.
635 * @param {boolean} isDefault is true if the option needs to be selected. 635 * @param {boolean} isDefault is true if the option needs to be selected.
636 * @param {boolean} isDisabled is true if the option needs to be disabled. 636 * @param {boolean} isDisabled is true if the option needs to be disabled.
637 * @return {Object} The created option. 637 * @return {Object} The created option.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 <include src="print_preview_animations.js"/> 1028 <include src="print_preview_animations.js"/>
1029 <include src="print_preview_cloud.js"/> 1029 <include src="print_preview_cloud.js"/>
1030 <include src="print_preview_utils.js"/> 1030 <include src="print_preview_utils.js"/>
1031 <include src="print_header.js"/> 1031 <include src="print_header.js"/>
1032 <include src="page_settings.js"/> 1032 <include src="page_settings.js"/>
1033 <include src="copies_settings.js"/> 1033 <include src="copies_settings.js"/>
1034 <include src="header_footer_settings.js"/> 1034 <include src="header_footer_settings.js"/>
1035 <include src="layout_settings.js"/> 1035 <include src="layout_settings.js"/>
1036 <include src="color_settings.js"/> 1036 <include src="color_settings.js"/>
1037 <include src="margin_settings.js"/> 1037 <include src="margin_settings.js"/>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698