Chromium Code Reviews| Index: chrome/browser/resources/print_preview/print_preview.js |
| =================================================================== |
| --- chrome/browser/resources/print_preview/print_preview.js (revision 105666) |
| +++ chrome/browser/resources/print_preview/print_preview.js (working copy) |
| @@ -171,6 +171,7 @@ |
| return; |
| showingSystemDialog = true; |
| disableInputElementsInSidebar(); |
| + printHeader.disableCancelButton(); |
| $('system-dialog-throbber').classList.remove('hidden'); |
| chrome.send('showSystemDialog'); |
| } |
| @@ -190,40 +191,6 @@ |
| } |
| /** |
| - * Disables the controls which need the initiator tab to generate preview |
| - * data. This function is called when the initiator tab has crashed. |
| - * @param {string} initiatorTabURL The URL of the initiator tab. |
| - */ |
| -function onInitiatorTabCrashed(initiatorTabURL) { |
| - disableInputElementsInSidebar(); |
| - if (initiatorTabURL) { |
| - displayErrorMessageWithButton( |
| - localStrings.getString('initiatorTabCrashed'), |
| - localStrings.getString('reopenPage'), |
| - function() { chrome.send('reloadCrashedInitiatorTab'); }); |
| - } else { |
| - displayErrorMessage(localStrings.getString('initiatorTabCrashed')); |
| - } |
| -} |
| - |
| -/** |
| - * Disables the controls which need the initiator tab to generate preview |
| - * data. This function is called when the initiator tab is closed. |
| - * @param {string} initiatorTabURL The URL of the initiator tab. |
| - */ |
| -function onInitiatorTabClosed(initiatorTabURL) { |
| - disableInputElementsInSidebar(); |
| - if (initiatorTabURL) { |
| - displayErrorMessageWithButton( |
| - localStrings.getString('initiatorTabClosed'), |
| - localStrings.getString('reopenPage'), |
| - function() { window.location = initiatorTabURL; }); |
| - } else { |
| - displayErrorMessage(localStrings.getString('initiatorTabClosed')); |
| - } |
| -} |
| - |
| -/** |
| * Gets the selected printer capabilities and updates the controls accordingly. |
| */ |
| function updateControlsWithSelectedPrinterCapabilities() { |
| @@ -295,6 +262,16 @@ |
| } |
| /** |
| + * Reloads the printer list for cloud print. |
| + */ |
| +function reloadCloudPrintersList() { |
|
Albert Bodenhamer
2011/10/17 16:43:42
Nit: Wont this reload all printers? I know you'r
Lei Zhang
2011/10/17 18:18:57
Done.
|
| + $('printer-list').length = 0; |
| + firstCloudPrintOptionPos = 0; |
| + lastCloudPrintOptionPos = 0; |
| + chrome.send('getPrinters'); |
| +} |
| + |
| +/** |
| * Turn on the integration of Cloud Print. |
| * @param {string} cloudPrintUrl The URL to use for cloud print servers. |
| */ |
| @@ -316,7 +293,7 @@ |
| * Cloud print upload of the PDF file is finished, time to close the dialog. |
| */ |
| function finishedCloudPrinting() { |
| - window.location = cloudprint.getBaseURL(); |
| + closePrintPreviewTab(); |
| } |
| /** |
| @@ -531,7 +508,7 @@ |
| * preview tab regarding the file selection cancel event. |
| */ |
| function fileSelectionCancelled() { |
| - // TODO(thestig) re-enable controls here. |
| + printHeader.enableCancelButton(); |
| } |
| /** |
| @@ -571,7 +548,7 @@ |
| /** |
| * Fill the printer list drop down. |
| - * Called from PrintPreviewHandler::SendPrinterList(). |
| + * Called from PrintPreviewHandler::SetupPrinterList(). |
| * @param {Array} printers Array of printer info objects. |
| */ |
| function setPrinters(printers) { |
| @@ -1081,6 +1058,7 @@ |
| */ |
| function closePrintPreviewTab() { |
| chrome.send('closePrintPreviewTab'); |
| + chrome.send('DialogClose'); |
| } |
| /** |
| @@ -1093,6 +1071,13 @@ |
| printHeader.disableCancelButton(); |
| closePrintPreviewTab(); |
| } |
| + if (e.keyCode == 80) { |
| + if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || |
| + (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { |
| + window.onkeydown = null; |
| + onSystemDialogLinkClicked(); |
| + } |
| + } |
| } |
| window.addEventListener('DOMContentLoaded', onLoad); |