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

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 + Release initiator when preview tab is closed. 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 365f51e6ccd3a45a9295dda2cf94674b050f6690..25cfef493d1ec64e83512f1229f07e64d16dd632 100644
--- a/chrome/browser/printing/print_preview_tab_controller.cc
+++ b/chrome/browser/printing/print_preview_tab_controller.cc
@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.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"
@@ -174,8 +175,13 @@ void PrintPreviewTabController::OnTabContentsDestroyed(TabContents* tab) {
if (tab == preview_tab) {
// Remove the initiator tab's observers before erasing the mapping.
TabContents* initiator_tab = GetInitiatorTab(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);
kmadhusu 2011/08/18 23:45:50 You need to delete the initiator tab request after
Sheridan Rawlins 2011/08/19 00:24:25 Done.
+ }
// Print preview tab contents are destroyed. Notify |PrintPreviewUI| to
// abort the initiator tab preview request.
@@ -248,8 +254,13 @@ void PrintPreviewTabController::OnNavEntryCommitted(
if (source_tab_is_preview_tab) {
// Remove the initiator tab's observers before erasing the mapping.
TabContents* initiator_tab = GetInitiatorTab(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);
+ }
preview_tab_map_.erase(tab);
} else {
preview_tab_map_[preview_tab] = NULL;

Powered by Google App Engine
This is Rietveld 408576698