| Index: chrome/browser/printing/background_printing_manager.cc
|
| ===================================================================
|
| --- chrome/browser/printing/background_printing_manager.cc (revision 110066)
|
| +++ chrome/browser/printing/background_printing_manager.cc (working copy)
|
| @@ -66,8 +66,6 @@
|
| content::Source<RenderProcessHost>(rph));
|
| }
|
|
|
| - RemoveFromTabStrip(preview_tab);
|
| -
|
| // Activate the initiator tab.
|
| PrintPreviewTabController* tab_controller =
|
| PrintPreviewTabController::GetInstance();
|
| @@ -81,45 +79,6 @@
|
| initiator_tab->tab_contents())->Activate();
|
| }
|
|
|
| -bool BackgroundPrintingManager::OwnInitiatorTab(
|
| - TabContentsWrapper* initiator_tab) {
|
| - DCHECK(CalledOnValidThread());
|
| - DCHECK(!PrintPreviewTabController::IsPrintPreviewTab(initiator_tab));
|
| - bool has_initiator_tab = false;
|
| - for (TabContentsWrapperMap::iterator it = map_.begin(); it != map_.end();
|
| - ++it) {
|
| - if (it->second == initiator_tab) {
|
| - has_initiator_tab = true;
|
| - break;
|
| - }
|
| - }
|
| - CHECK(!has_initiator_tab);
|
| -
|
| - PrintPreviewTabController* tab_controller =
|
| - PrintPreviewTabController::GetInstance();
|
| - if (!tab_controller)
|
| - return false;
|
| - TabContentsWrapper* preview_tab =
|
| - tab_controller->GetPrintPreviewForTab(initiator_tab);
|
| - if (!preview_tab)
|
| - return false;
|
| -
|
| - map_[preview_tab] = initiator_tab;
|
| -
|
| - // OwnPrintPreviewTab() may have already added this notification.
|
| - TabContents* preview_contents = preview_tab->tab_contents();
|
| - if (!registrar_.IsRegistered(
|
| - this,
|
| - content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
|
| - content::Source<TabContents>(preview_contents))) {
|
| - registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
|
| - content::Source<TabContents>(preview_contents));
|
| - }
|
| -
|
| - RemoveFromTabStrip(initiator_tab);
|
| - return true;
|
| -}
|
| -
|
| void BackgroundPrintingManager::Observe(
|
| int type,
|
| const content::NotificationSource& source,
|
| @@ -170,26 +129,15 @@
|
|
|
| void BackgroundPrintingManager::OnTabContentsDestroyed(
|
| TabContentsWrapper* preview_tab) {
|
| - bool is_owned_printing_tab = HasPrintPreviewTab(preview_tab);
|
| - bool is_preview_tab_for_owned_initator_tab =
|
| - (map_.find(preview_tab) != map_.end());
|
| - DCHECK(is_owned_printing_tab || is_preview_tab_for_owned_initator_tab);
|
| -
|
| // Always need to remove this notification since the tab is gone.
|
| registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
|
| content::Source<TabContents>(preview_tab->tab_contents()));
|
|
|
| - // Delete the associated initiator tab if one exists.
|
| - if (is_preview_tab_for_owned_initator_tab) {
|
| - TabContentsWrapper* initiator_tab = map_[preview_tab];
|
| - map_.erase(preview_tab);
|
| - MessageLoop::current()->DeleteSoon(FROM_HERE, initiator_tab);
|
| + if (!HasPrintPreviewTab(preview_tab)) {
|
| + NOTREACHED();
|
| + return;
|
| }
|
|
|
| - // If |preview_tab| is not owned, then we are done.
|
| - if (!is_owned_printing_tab)
|
| - return;
|
| -
|
| // Remove NOTIFICATION_RENDERER_PROCESS_CLOSED if |preview_tab| is the last
|
| // TabContents associated with |rph|.
|
| bool shared_rph = HasSharedRenderProcessHost(printing_tabs_, preview_tab) ||
|
| @@ -212,18 +160,6 @@
|
| }
|
| }
|
|
|
| -void BackgroundPrintingManager::RemoveFromTabStrip(TabContentsWrapper* tab) {
|
| - Browser* browser = BrowserList::FindBrowserWithID(
|
| - tab->restore_tab_helper()->window_id().id());
|
| - DCHECK(browser);
|
| -
|
| - TabStripModel* tabstrip = browser->tabstrip_model();
|
| - int index = tabstrip->GetIndexOfTabContents(tab);
|
| - if (index == TabStripModel::kNoTab)
|
| - return;
|
| - tabstrip->DetachTabContentsAt(index);
|
| -}
|
| -
|
| void BackgroundPrintingManager::DeletePreviewTab(TabContentsWrapper* tab) {
|
| registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED,
|
| content::Source<TabContentsWrapper>(tab));
|
|
|