| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/printing/background_printing_manager.h" | 5 #include "chrome/browser/printing/background_printing_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/printing/print_job.h" | 7 #include "chrome/browser/printing/print_job.h" |
| 8 #include "chrome/browser/printing/print_preview_tab_controller.h" | 8 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 9 #include "chrome/browser/sessions/restore_tab_helper.h" | 9 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 10 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Always need to remove this notification since the tab is gone. | 137 // Always need to remove this notification since the tab is gone. |
| 138 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 138 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 139 content::Source<WebContents>(preview_tab->web_contents())); | 139 content::Source<WebContents>(preview_tab->web_contents())); |
| 140 | 140 |
| 141 if (!HasPrintPreviewTab(preview_tab)) { | 141 if (!HasPrintPreviewTab(preview_tab)) { |
| 142 NOTREACHED(); | 142 NOTREACHED(); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Remove NOTIFICATION_RENDERER_PROCESS_CLOSED if |preview_tab| is the last | 146 // Remove NOTIFICATION_RENDERER_PROCESS_CLOSED if |preview_tab| is the last |
| 147 // TabContents associated with |rph|. | 147 // WebContents associated with |rph|. |
| 148 bool shared_rph = HasSharedRenderProcessHost(printing_tabs_, preview_tab) || | 148 bool shared_rph = HasSharedRenderProcessHost(printing_tabs_, preview_tab) || |
| 149 HasSharedRenderProcessHost(printing_tabs_pending_deletion_, preview_tab); | 149 HasSharedRenderProcessHost(printing_tabs_pending_deletion_, preview_tab); |
| 150 if (!shared_rph) { | 150 if (!shared_rph) { |
| 151 content::RenderProcessHost* rph = | 151 content::RenderProcessHost* rph = |
| 152 preview_tab->web_contents()->GetRenderProcessHost(); | 152 preview_tab->web_contents()->GetRenderProcessHost(); |
| 153 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 153 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 154 content::Source<content::RenderProcessHost>(rph)); | 154 content::Source<content::RenderProcessHost>(rph)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Remove other notifications and remove the tab from its | 157 // Remove other notifications and remove the tab from its |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 bool BackgroundPrintingManager::HasPrintPreviewTab( | 203 bool BackgroundPrintingManager::HasPrintPreviewTab( |
| 204 TabContentsWrapper* preview_tab) { | 204 TabContentsWrapper* preview_tab) { |
| 205 if (printing_tabs_.find(preview_tab) != printing_tabs_.end()) | 205 if (printing_tabs_.find(preview_tab) != printing_tabs_.end()) |
| 206 return true; | 206 return true; |
| 207 return printing_tabs_pending_deletion_.find(preview_tab) != | 207 return printing_tabs_pending_deletion_.find(preview_tab) != |
| 208 printing_tabs_pending_deletion_.end(); | 208 printing_tabs_pending_deletion_.end(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace printing | 211 } // namespace printing |
| OLD | NEW |