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

Unified Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 8564044: Revert 110056 - Print Preview: Make print preview tab modal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/print_header.js ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/resources/print_preview/print_header.js ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698