Index: chrome/browser/resources/print_preview/print_preview.js |
=================================================================== |
--- chrome/browser/resources/print_preview/print_preview.js (revision 110058) |
+++ chrome/browser/resources/print_preview/print_preview.js (working copy) |
@@ -206,7 +206,6 @@ |
return; |
showingSystemDialog = true; |
disableInputElementsInSidebar(); |
- printHeader.disableCancelButton(); |
$('system-dialog-throbber').hidden = false; |
chrome.send('showSystemDialog'); |
} |
@@ -226,6 +225,42 @@ |
} |
/** |
+ * 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) { |
+ previewArea.displayErrorMessageWithButtonAndNotify( |
+ localStrings.getString('initiatorTabCrashed'), |
+ localStrings.getString('reopenPage'), |
+ function() { chrome.send('reloadCrashedInitiatorTab'); }); |
+ } else { |
+ previewArea.displayErrorMessageAndNotify( |
+ 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) { |
+ previewArea.displayErrorMessageWithButtonAndNotify( |
+ localStrings.getString('initiatorTabClosed'), |
+ localStrings.getString('reopenPage'), |
+ function() { window.location = initiatorTabURL; }); |
+ } else { |
+ previewArea.displayErrorMessageAndNotify( |
+ localStrings.getString('initiatorTabClosed')); |
+ } |
+} |
+ |
+/** |
* Gets the selected printer capabilities and updates the controls accordingly. |
*/ |
function updateControlsWithSelectedPrinterCapabilities() { |
@@ -304,16 +339,6 @@ |
} |
/** |
- * Reloads the printer list. |
- */ |
-function reloadPrintersList() { |
- $('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. |
*/ |
@@ -335,7 +360,7 @@ |
* Cloud print upload of the PDF file is finished, time to close the dialog. |
*/ |
function finishedCloudPrinting() { |
- closePrintPreviewTab(); |
+ window.location = cloudprint.getBaseURL(); |
} |
/** |
@@ -553,7 +578,7 @@ |
* preview tab regarding the file selection cancel event. |
*/ |
function fileSelectionCancelled() { |
- printHeader.enableCancelButton(); |
+ // TODO(thestig) re-enable controls here. |
} |
/** |
@@ -594,7 +619,7 @@ |
/** |
* Fill the printer list drop down. |
- * Called from PrintPreviewHandler::SetupPrinterList(). |
+ * Called from PrintPreviewHandler::SendPrinterList(). |
* @param {Array} printers Array of printer info objects. |
*/ |
function setPrinters(printers) { |
@@ -1060,7 +1085,6 @@ |
*/ |
function closePrintPreviewTab() { |
chrome.send('closePrintPreviewTab'); |
- chrome.send('DialogClose'); |
} |
/** |
@@ -1073,13 +1097,6 @@ |
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); |