| Index: chrome/browser/printing/print_preview_tab_controller.cc
|
| diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc
|
| index c552adac813b0a084e0d570ae2e3605ecef297ad..c5001a128355dfeeefdabd7c0206e8c97d726163 100644
|
| --- a/chrome/browser/printing/print_preview_tab_controller.cc
|
| +++ b/chrome/browser/printing/print_preview_tab_controller.cc
|
| @@ -5,8 +5,10 @@
|
| #include "chrome/browser/printing/print_preview_tab_controller.h"
|
|
|
| #include "base/command_line.h"
|
| +#include "base/debug/stack_trace.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/printing/background_printing_manager.h"
|
| #include "chrome/browser/sessions/restore_tab_helper.h"
|
| #include "chrome/browser/tabs/tab_strip_model.h"
|
| #include "chrome/browser/ui/browser.h"
|
| @@ -138,8 +140,13 @@ void PrintPreviewTabController::Observe(int type,
|
| if (source_tab_is_preview_tab) {
|
| // Remove the initiator tab's observers before erasing the mapping.
|
| TabContents* initiator_tab = GetInitiatorTab(source_tab);
|
| - if (initiator_tab)
|
| + if (initiator_tab) {
|
| RemoveObservers(initiator_tab);
|
| + TabContentsWrapper* initiator_wrapper =
|
| + TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab);
|
| + g_browser_process->background_printing_manager()->
|
| + ReleaseInitiatorTabContents(initiator_wrapper);
|
| + }
|
|
|
| // |source_tab_is_preview_tab| is misleading in the case where the user
|
| // chooses to re-open the initiator tab after closing it, as |source_tab|
|
| @@ -152,6 +159,7 @@ void PrintPreviewTabController::Observe(int type,
|
| }
|
|
|
| // Erase the map entry.
|
| + DLOG(INFO) << "erasing " << (void*)source_tab;
|
| preview_tab_map_.erase(source_tab);
|
| } else {
|
| // Initiator tab is closed. Disable the controls in preview tab.
|
| @@ -160,6 +168,7 @@ void PrintPreviewTabController::Observe(int type,
|
| print_preview_ui->OnInitiatorTabClosed(source_tab->GetURL().spec());
|
|
|
| // |source_tab| is an initiator tab, update the map entry.
|
| + DLOG(INFO) << "initiator tab closed; NULLING " << (void*)preview_tab;
|
| preview_tab_map_[preview_tab] = NULL;
|
| }
|
| RemoveObservers(source_tab);
|
| @@ -179,6 +188,8 @@ void PrintPreviewTabController::EraseInitiatorTabInfo(
|
| return;
|
|
|
| RemoveObservers(it->second);
|
| + DLOG(INFO) << __FUNCTION__ << ' ' << (void*)preview_tab;
|
| + base::debug::StackTrace().PrintBacktrace();
|
| preview_tab_map_[preview_tab] = NULL;
|
| }
|
|
|
|
|