OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/print_preview_tab_controller.h" | 5 #include "chrome/browser/printing/print_preview_tab_controller.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/sessions/restore_tab_helper.h" | 8 #include "chrome/browser/sessions/restore_tab_helper.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return; | 131 return; |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 if (source_tab_is_preview_tab) { | 135 if (source_tab_is_preview_tab) { |
136 // Remove the initiator tab's observers before erasing the mapping. | 136 // Remove the initiator tab's observers before erasing the mapping. |
137 TabContents* initiator_tab = GetInitiatorTab(source_tab); | 137 TabContents* initiator_tab = GetInitiatorTab(source_tab); |
138 if (initiator_tab) | 138 if (initiator_tab) |
139 RemoveObservers(initiator_tab); | 139 RemoveObservers(initiator_tab); |
140 | 140 |
| 141 PrintPreviewUI* print_preview_ui = |
| 142 static_cast<PrintPreviewUI*>(source_tab->web_ui()); |
| 143 print_preview_ui->OnNavigation(); |
| 144 |
141 // Erase the map entry. | 145 // Erase the map entry. |
142 preview_tab_map_.erase(source_tab); | 146 preview_tab_map_.erase(source_tab); |
143 } else { | 147 } else { |
144 // Initiator tab is closed. Disable the controls in preview tab. | 148 // Initiator tab is closed. Disable the controls in preview tab. |
145 PrintPreviewUI* print_preview_ui = | 149 PrintPreviewUI* print_preview_ui = |
146 static_cast<PrintPreviewUI*>(preview_tab->web_ui()); | 150 static_cast<PrintPreviewUI*>(preview_tab->web_ui()); |
147 print_preview_ui->OnInitiatorTabClosed(source_tab->GetURL().spec()); | 151 print_preview_ui->OnInitiatorTabClosed(source_tab->GetURL().spec()); |
148 | 152 |
149 // |source_tab| is an initiator tab, update the map entry. | 153 // |source_tab| is an initiator tab, update the map entry. |
150 preview_tab_map_[preview_tab] = NULL; | 154 preview_tab_map_[preview_tab] = NULL; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 233 } |
230 | 234 |
231 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { | 235 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { |
232 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, | 236 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, |
233 Source<TabContents>(tab)); | 237 Source<TabContents>(tab)); |
234 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, | 238 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, |
235 Source<NavigationController>(&tab->controller())); | 239 Source<NavigationController>(&tab->controller())); |
236 } | 240 } |
237 | 241 |
238 } // namespace printing | 242 } // namespace printing |
OLD | NEW |