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()); | |
Lei Zhang
2011/06/28 20:55:35
For the case of: open print preview; close initiat
Lei Zhang
2011/06/28 20:58:04
Probably just want to check with IsPrintPreviewTab
| |
143 if (print_preview_ui) | |
144 print_preview_ui->OnNavigation(); | |
145 | |
141 // Erase the map entry. | 146 // Erase the map entry. |
142 preview_tab_map_.erase(source_tab); | 147 preview_tab_map_.erase(source_tab); |
143 } else { | 148 } else { |
144 // Initiator tab is closed. Disable the controls in preview tab. | 149 // Initiator tab is closed. Disable the controls in preview tab. |
145 PrintPreviewUI* print_preview_ui = | 150 PrintPreviewUI* print_preview_ui = |
146 static_cast<PrintPreviewUI*>(preview_tab->web_ui()); | 151 static_cast<PrintPreviewUI*>(preview_tab->web_ui()); |
147 print_preview_ui->OnInitiatorTabClosed(source_tab->GetURL().spec()); | 152 print_preview_ui->OnInitiatorTabClosed(source_tab->GetURL().spec()); |
148 | 153 |
149 // |source_tab| is an initiator tab, update the map entry. | 154 // |source_tab| is an initiator tab, update the map entry. |
150 preview_tab_map_[preview_tab] = NULL; | 155 preview_tab_map_[preview_tab] = NULL; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 } | 234 } |
230 | 235 |
231 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { | 236 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { |
232 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, | 237 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, |
233 Source<TabContents>(tab)); | 238 Source<TabContents>(tab)); |
234 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, | 239 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, |
235 Source<NavigationController>(&tab->controller())); | 240 Source<NavigationController>(&tab->controller())); |
236 } | 241 } |
237 | 242 |
238 } // namespace printing | 243 } // namespace printing |
OLD | NEW |