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

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

Issue 8915027: Print preview: A quick hack to support printing to the default printer without user confirmation ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // True when a pending print file request exists. 47 // True when a pending print file request exists.
48 var hasPendingPrintDocumentRequest = false; 48 var hasPendingPrintDocumentRequest = false;
49 49
50 // True when the complete metafile for the previewed doc is ready. 50 // True when the complete metafile for the previewed doc is ready.
51 var isPrintReadyMetafileReady = false; 51 var isPrintReadyMetafileReady = false;
52 52
53 // True when preview tab is hidden. 53 // True when preview tab is hidden.
54 var isTabHidden = false; 54 var isTabHidden = false;
55 55
56 // True in kiosk mode where print preview can print automatically without
57 // user intervention. See http://crbug.com/31395.
58 var printAutomaticallyInKioskMode = false;
59
56 // @type {print_preview.PrintHeader} Holds the print and cancel buttons. 60 // @type {print_preview.PrintHeader} Holds the print and cancel buttons.
57 var printHeader; 61 var printHeader;
58 62
59 // @type {print_preview.PageSettings} Holds all the pages related settings. 63 // @type {print_preview.PageSettings} Holds all the pages related settings.
60 var pageSettings; 64 var pageSettings;
61 65
62 // @type {print_preview.CopiesSettings} Holds all the copies related settings. 66 // @type {print_preview.CopiesSettings} Holds all the copies related settings.
63 var copiesSettings; 67 var copiesSettings;
64 68
65 // @type {print_preview.LayoutSettings} Holds all the layout related settings. 69 // @type {print_preview.LayoutSettings} Holds all the layout related settings.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 setInitiatorTabTitle(initialSettings['initiatorTabTitle']); 188 setInitiatorTabTitle(initialSettings['initiatorTabTitle']);
185 previewModifiable = initialSettings['previewModifiable']; 189 previewModifiable = initialSettings['previewModifiable'];
186 if (previewModifiable) { 190 if (previewModifiable) {
187 print_preview.MarginSettings.setNumberFormatAndMeasurementSystem( 191 print_preview.MarginSettings.setNumberFormatAndMeasurementSystem(
188 initialSettings['numberFormat'], 192 initialSettings['numberFormat'],
189 initialSettings['measurementSystem']); 193 initialSettings['measurementSystem']);
190 marginSettings.setLastUsedMargins(initialSettings); 194 marginSettings.setLastUsedMargins(initialSettings);
191 } 195 }
192 setDefaultPrinter(initialSettings['printerName'], 196 setDefaultPrinter(initialSettings['printerName'],
193 initialSettings['cloudPrintData']); 197 initialSettings['cloudPrintData']);
198 printAutomaticallyInKioskMode =
199 initialSettings['printAutomaticallyInKioskMode'];
194 } 200 }
195 201
196 /** 202 /**
197 * Disables the input elements in the sidebar. 203 * Disables the input elements in the sidebar.
198 */ 204 */
199 function disableInputElementsInSidebar() { 205 function disableInputElementsInSidebar() {
200 var els = $('navbar-container').querySelectorAll('input, button, select'); 206 var els = $('navbar-container').querySelectorAll('input, button, select');
201 for (var i = 0; i < els.length; i++) { 207 for (var i = 0; i < els.length; i++) {
202 if (els[i] == printHeader.cancelButton) 208 if (els[i] == printHeader.cancelButton)
203 continue; 209 continue;
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 * Called when the PDF plugin loads its document. 814 * Called when the PDF plugin loads its document.
809 */ 815 */
810 function onPDFLoad() { 816 function onPDFLoad() {
811 if (previewModifiable) { 817 if (previewModifiable) {
812 setPluginPreviewPageCount(); 818 setPluginPreviewPageCount();
813 } 819 }
814 cr.dispatchSimpleEvent(document, customEvents.PDF_LOADED); 820 cr.dispatchSimpleEvent(document, customEvents.PDF_LOADED);
815 isFirstPageLoaded = true; 821 isFirstPageLoaded = true;
816 checkAndHideOverlayLayerIfValid(); 822 checkAndHideOverlayLayerIfValid();
817 sendPrintDocumentRequestIfNeeded(); 823 sendPrintDocumentRequestIfNeeded();
824 if (printAutomaticallyInKioskMode)
825 printHeader.printButton.click();
818 } 826 }
819 827
820 function setPluginPreviewPageCount() { 828 function setPluginPreviewPageCount() {
821 $('pdf-viewer').printPreviewPageCount( 829 $('pdf-viewer').printPreviewPageCount(
822 pageSettings.previouslySelectedPages.length); 830 pageSettings.previouslySelectedPages.length);
823 } 831 }
824 832
825 /** 833 /**
826 * Update the page count and check the page range. 834 * Update the page count and check the page range.
827 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). 835 * Called from PrintPreviewUI::OnDidGetPreviewPageCount().
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 <include src="copies_settings.js"/> 1160 <include src="copies_settings.js"/>
1153 <include src="header_footer_settings.js"/> 1161 <include src="header_footer_settings.js"/>
1154 <include src="layout_settings.js"/> 1162 <include src="layout_settings.js"/>
1155 <include src="color_settings.js"/> 1163 <include src="color_settings.js"/>
1156 <include src="margin_settings.js"/> 1164 <include src="margin_settings.js"/>
1157 <include src="margin_textbox.js"/> 1165 <include src="margin_textbox.js"/>
1158 <include src="margin_utils.js"/> 1166 <include src="margin_utils.js"/>
1159 <include src="margins_ui.js"/> 1167 <include src="margins_ui.js"/>
1160 <include src="margins_ui_pair.js"/> 1168 <include src="margins_ui_pair.js"/>
1161 <include src="preview_area.js"/> 1169 <include src="preview_area.js"/>
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698