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

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

Issue 8520011: Print Preview: Make print preview tab modal. (try 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: disable tests in touch_ui, fix failing test 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
Index: chrome/browser/resources/print_preview/print_preview.js
===================================================================
--- chrome/browser/resources/print_preview/print_preview.js (revision 110066)
+++ chrome/browser/resources/print_preview/print_preview.js (working copy)
@@ -206,6 +206,7 @@
return;
showingSystemDialog = true;
disableInputElementsInSidebar();
+ printHeader.disableCancelButton();
$('system-dialog-throbber').hidden = false;
chrome.send('showSystemDialog');
}
@@ -225,42 +226,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) {
- 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() {
@@ -339,6 +304,16 @@
}
/**
+ * 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.
*/
@@ -360,7 +335,7 @@
* Cloud print upload of the PDF file is finished, time to close the dialog.
*/
function finishedCloudPrinting() {
- window.location = cloudprint.getBaseURL();
+ closePrintPreviewTab();
}
/**
@@ -578,7 +553,7 @@
* preview tab regarding the file selection cancel event.
*/
function fileSelectionCancelled() {
- // TODO(thestig) re-enable controls here.
+ printHeader.enableCancelButton();
}
/**
@@ -619,7 +594,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) {
@@ -1085,6 +1060,7 @@
*/
function closePrintPreviewTab() {
chrome.send('closePrintPreviewTab');
+ chrome.send('DialogClose');
}
/**
@@ -1097,6 +1073,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);

Powered by Google App Engine
This is Rietveld 408576698