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

Unified Diff: chrome/browser/printing/print_preview_tab_controller.cc

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 4 months 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/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;
}

Powered by Google App Engine
This is Rietveld 408576698