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

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

Issue 8138020: PrintPreview: Fix printer color settings issues based on printer ppd/schema information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments 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
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 selectedValue == MANAGE_LOCAL_PRINTERS) { 235 selectedValue == MANAGE_LOCAL_PRINTERS) {
236 printerList.selectedIndex = lastSelectedPrinterIndex; 236 printerList.selectedIndex = lastSelectedPrinterIndex;
237 chrome.send(selectedValue); 237 chrome.send(selectedValue);
238 skip_refresh = true; 238 skip_refresh = true;
239 } else if (selectedValue == PRINT_TO_PDF || 239 } else if (selectedValue == PRINT_TO_PDF ||
240 selectedValue == PRINT_WITH_CLOUD_PRINT) { 240 selectedValue == PRINT_WITH_CLOUD_PRINT) {
241 updateWithPrinterCapabilities({ 241 updateWithPrinterCapabilities({
242 'disableColorOption': true, 242 'disableColorOption': true,
243 'setColorAsDefault': true, 243 'setColorAsDefault': true,
244 'setDuplexAsDefault': false, 244 'setDuplexAsDefault': false,
245 'printerColorModelForColor': colorSettings.COLOR, 245 'printerColorModelForColor': print_preview.ColorSettings.COLOR,
246 'printerDefaultDuplexValue': copiesSettings.UNKNOWN_DUPLEX_MODE, 246 'printerDefaultDuplexValue': copiesSettings.UNKNOWN_DUPLEX_MODE,
247 'disableCopiesOption': true}); 247 'disableCopiesOption': true});
248 } else { 248 } else {
249 // This message will call back to 'updateWithPrinterCapabilities' 249 // This message will call back to 'updateWithPrinterCapabilities'
250 // function. 250 // function.
251 chrome.send('getPrinterCapabilities', [selectedValue]); 251 chrome.send('getPrinterCapabilities', [selectedValue]);
252 } 252 }
253 if (!skip_refresh) { 253 if (!skip_refresh) {
254 lastSelectedPrinterIndex = selectedIndex; 254 lastSelectedPrinterIndex = selectedIndex;
255 255
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 */ 949 */
950 function createPDFPlugin(srcDataIndex) { 950 function createPDFPlugin(srcDataIndex) {
951 var pdfViewer = $('pdf-viewer'); 951 var pdfViewer = $('pdf-viewer');
952 var srcURL = getPageSrcURL(currentPreviewUid, srcDataIndex); 952 var srcURL = getPageSrcURL(currentPreviewUid, srcDataIndex);
953 if (pdfViewer) { 953 if (pdfViewer) {
954 // Need to call this before the reload(), where the plugin resets its 954 // Need to call this before the reload(), where the plugin resets its
955 // internal page count. 955 // internal page count.
956 pdfViewer.goToPage('0'); 956 pdfViewer.goToPage('0');
957 pdfViewer.resetPrintPreviewUrl(srcURL); 957 pdfViewer.resetPrintPreviewUrl(srcURL);
958 pdfViewer.reload(); 958 pdfViewer.reload();
959 pdfViewer.grayscale(colorSettings.colorMode == colorSettings.GRAY); 959 pdfViewer.grayscale(
960 colorSettings.colorMode == print_preview.ColorSettings.GRAY);
960 return; 961 return;
961 } 962 }
962 963
963 pdfViewer = document.createElement('embed'); 964 pdfViewer = document.createElement('embed');
964 pdfViewer.setAttribute('id', 'pdf-viewer'); 965 pdfViewer.setAttribute('id', 'pdf-viewer');
965 pdfViewer.setAttribute('type', 966 pdfViewer.setAttribute('type',
966 'application/x-google-chrome-print-preview-pdf'); 967 'application/x-google-chrome-print-preview-pdf');
967 pdfViewer.setAttribute('src', srcURL); 968 pdfViewer.setAttribute('src', srcURL);
968 pdfViewer.setAttribute('aria-live', 'polite'); 969 pdfViewer.setAttribute('aria-live', 'polite');
969 pdfViewer.setAttribute('aria-atomic', 'true'); 970 pdfViewer.setAttribute('aria-atomic', 'true');
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 <include src="print_preview_animations.js"/> 1055 <include src="print_preview_animations.js"/>
1055 <include src="print_preview_cloud.js"/> 1056 <include src="print_preview_cloud.js"/>
1056 <include src="print_preview_utils.js"/> 1057 <include src="print_preview_utils.js"/>
1057 <include src="print_header.js"/> 1058 <include src="print_header.js"/>
1058 <include src="page_settings.js"/> 1059 <include src="page_settings.js"/>
1059 <include src="copies_settings.js"/> 1060 <include src="copies_settings.js"/>
1060 <include src="header_footer_settings.js"/> 1061 <include src="header_footer_settings.js"/>
1061 <include src="layout_settings.js"/> 1062 <include src="layout_settings.js"/>
1062 <include src="color_settings.js"/> 1063 <include src="color_settings.js"/>
1063 <include src="margin_settings.js"/> 1064 <include src="margin_settings.js"/>
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/color_settings.js ('k') | chrome/browser/ui/webui/print_preview_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698