Index: chrome/browser/ui/webui/print_preview_handler.cc |
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc |
index 8d4aff67125967a527e2d81bc5646636d8274c36..8a141e6b6042e2856edfd8218178217980dbf829 100644 |
--- a/chrome/browser/ui/webui/print_preview_handler.cc |
+++ b/chrome/browser/ui/webui/print_preview_handler.cc |
@@ -568,13 +568,12 @@ void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { |
TabContents* initiator_tab = GetInitiatorTab(); |
if (!initiator_tab) |
return; |
- initiator_tab->Activate(); |
TabContentsWrapper* wrapper = |
TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
- wrapper->print_view_manager()->PrintNow(); |
- |
- ClosePrintPreviewTab(); |
+ printing::PrintViewManager* manager = wrapper->print_view_manager(); |
+ manager->set_observer(this); |
+ manager->PrintNow(); |
} |
void PrintPreviewHandler::HandleManagePrinters(const ListValue* args) { |
@@ -647,6 +646,14 @@ void PrintPreviewHandler::ClosePrintPreviewTab() { |
&preview_tab()->controller()), TabStripModel::CLOSE_NONE); |
} |
+void PrintPreviewHandler::OnPrintDialogShown() { |
+ TabContents* initiator_tab = GetInitiatorTab(); |
+ DCHECK(initiator_tab); |
+ |
+ initiator_tab->Activate(); |
+ ClosePrintPreviewTab(); |
+} |
+ |
void PrintPreviewHandler::SelectFile(const FilePath& default_filename) { |
SelectFileDialog::FileTypeInfo file_type_info; |
file_type_info.extensions.resize(1); |
@@ -677,6 +684,16 @@ void PrintPreviewHandler::SelectFile(const FilePath& default_filename) { |
NULL); |
} |
+void PrintPreviewHandler::OnNavigation() { |
+ TabContents* initiator_tab = GetInitiatorTab(); |
+ if (!initiator_tab) |
+ return; |
+ |
+ TabContentsWrapper* wrapper = |
+ TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
+ wrapper->print_view_manager()->set_observer(NULL); |
+} |
+ |
void PrintPreviewHandler::FileSelected(const FilePath& path, |
int index, void* params) { |
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); |
@@ -714,13 +731,14 @@ void PrintPreviewHandler::HidePreviewTab() { |
void PrintPreviewHandler::ClearInitiatorTabDetails() { |
TabContents* initiator_tab = GetInitiatorTab(); |
- if (initiator_tab) { |
- // We no longer require the intiator tab details. Remove those details |
- // associated with the preview tab to allow the initiator tab to create |
- // another preview tab. |
- printing::PrintPreviewTabController* tab_controller = |
- printing::PrintPreviewTabController::GetInstance(); |
- if (tab_controller) |
- tab_controller->EraseInitiatorTabInfo(preview_tab()); |
- } |
+ if (!initiator_tab) |
+ return; |
+ |
+ // We no longer require the initiator tab details. Remove those details |
+ // associated with the preview tab to allow the initiator tab to create |
+ // another preview tab. |
+ printing::PrintPreviewTabController* tab_controller = |
+ printing::PrintPreviewTabController::GetInstance(); |
+ if (tab_controller) |
+ tab_controller->EraseInitiatorTabInfo(preview_tab()); |
} |