Commit a9e19eb6 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Remove bad CallJavascriptFunctionUnsafe call from PrintPreviewUI

"cancelPendingPrintRequest" does not actually exist. Remove the call to
this function from the PrintPreviewUI.

BUG=740264

Review-Url: https://codereview.chromium.org/2974183002
Cr-Commit-Position: refs/heads/master@{#485982}
parent 026d677f
...@@ -113,6 +113,11 @@ void BackgroundPrintingManager::DeletePreviewContentsForBrowserContext( ...@@ -113,6 +113,11 @@ void BackgroundPrintingManager::DeletePreviewContentsForBrowserContext(
} }
} }
void BackgroundPrintingManager::OnPrintRequestCancelled(
WebContents* preview_contents) {
DeletePreviewContents(preview_contents);
}
void BackgroundPrintingManager::DeletePreviewContents( void BackgroundPrintingManager::DeletePreviewContents(
WebContents* preview_contents) { WebContents* preview_contents) {
auto i = printing_contents_map_.find(preview_contents); auto i = printing_contents_map_.find(preview_contents);
......
...@@ -48,6 +48,8 @@ class BackgroundPrintingManager : public content::NotificationObserver { ...@@ -48,6 +48,8 @@ class BackgroundPrintingManager : public content::NotificationObserver {
void DeletePreviewContentsForBrowserContext( void DeletePreviewContentsForBrowserContext(
content::BrowserContext* browser_context); content::BrowserContext* browser_context);
void OnPrintRequestCancelled(content::WebContents* preview_dialog);
private: private:
// content::NotificationObserver overrides: // content::NotificationObserver overrides:
void Observe(int type, void Observe(int type,
......
...@@ -1594,6 +1594,10 @@ void PrintPreviewHandler::OnPrintPreviewCancelled() { ...@@ -1594,6 +1594,10 @@ void PrintPreviewHandler::OnPrintPreviewCancelled() {
preview_callbacks_.pop(); preview_callbacks_.pop();
} }
void PrintPreviewHandler::OnPrintRequestCancelled() {
HandleCancelPendingPrintRequest(nullptr);
}
#if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG) #if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
void PrintPreviewHandler::ShowSystemDialog() { void PrintPreviewHandler::ShowSystemDialog() {
HandleShowSystemDialog(NULL); HandleShowSystemDialog(NULL);
......
...@@ -86,6 +86,9 @@ class PrintPreviewHandler ...@@ -86,6 +86,9 @@ class PrintPreviewHandler
// Called when print preview is ready. // Called when print preview is ready.
void OnPrintPreviewReady(int preview_uid, int request_id); void OnPrintPreviewReady(int preview_uid, int request_id);
// Called when a print request is cancelled due to its initiator closing.
void OnPrintRequestCancelled();
// Send the print preset options from the document. // Send the print preset options from the document.
void SendPrintPresetOptions(bool disable_scaling, int copies, int duplex); void SendPrintPresetOptions(bool disable_scaling, int copies, int duplex);
......
...@@ -533,13 +533,20 @@ void PrintPreviewUI::OnPrintPreviewDialogClosed() { ...@@ -533,13 +533,20 @@ void PrintPreviewUI::OnPrintPreviewDialogClosed() {
} }
void PrintPreviewUI::OnInitiatorClosed() { void PrintPreviewUI::OnInitiatorClosed() {
// Should only get here if the initiator was still tracked by the Print
// Preview Dialog Controller, so the print job has not yet been sent.
WebContents* preview_dialog = web_ui()->GetWebContents(); WebContents* preview_dialog = web_ui()->GetWebContents();
printing::BackgroundPrintingManager* background_printing_manager = printing::BackgroundPrintingManager* background_printing_manager =
g_browser_process->background_printing_manager(); g_browser_process->background_printing_manager();
if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) {
web_ui()->CallJavascriptFunctionUnsafe("cancelPendingPrintRequest"); // Dialog is hidden but is still generating the preview. Cancel the print
else // request as it can't be completed.
background_printing_manager->OnPrintRequestCancelled(preview_dialog);
handler_->OnPrintRequestCancelled();
} else {
// Initiator was closed while print preview dialog was still open.
OnClosePrintPreviewDialog(); OnClosePrintPreviewDialog();
}
} }
void PrintPreviewUI::OnPrintPreviewCancelled() { void PrintPreviewUI::OnPrintPreviewCancelled() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment