| 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/print_preview_tab_controller.h" | 5 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 // static | 210 // static |
| 211 void PrintPreviewTabController::PrintPreview(TabContentsWrapper* tab) { | 211 void PrintPreviewTabController::PrintPreview(TabContentsWrapper* tab) { |
| 212 if (tab->web_contents()->ShowingInterstitialPage()) | 212 if (tab->web_contents()->ShowingInterstitialPage()) |
| 213 return; | 213 return; |
| 214 | 214 |
| 215 PrintPreviewTabController* tab_controller = GetInstance(); | 215 PrintPreviewTabController* tab_controller = GetInstance(); |
| 216 if (!tab_controller) | 216 if (!tab_controller) |
| 217 return; | 217 return; |
| 218 tab_controller->GetOrCreatePreviewTab(tab); | 218 if (!tab_controller->GetOrCreatePreviewTab(tab)) |
| 219 tab->print_view_manager()->PrintPreviewDone(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 TabContentsWrapper* PrintPreviewTabController::GetOrCreatePreviewTab( | 222 TabContentsWrapper* PrintPreviewTabController::GetOrCreatePreviewTab( |
| 222 TabContentsWrapper* initiator_tab) { | 223 TabContentsWrapper* initiator_tab) { |
| 223 DCHECK(initiator_tab); | 224 DCHECK(initiator_tab); |
| 224 | 225 |
| 225 // Get the print preview tab for |initiator_tab|. | 226 // Get the print preview tab for |initiator_tab|. |
| 226 TabContentsWrapper* preview_tab = GetPrintPreviewForTab(initiator_tab); | 227 TabContentsWrapper* preview_tab = GetPrintPreviewForTab(initiator_tab); |
| 227 if (!preview_tab) | 228 if (!preview_tab) |
| 228 return CreatePrintPreviewTab(initiator_tab); | 229 return CreatePrintPreviewTab(initiator_tab); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 538 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
| 538 preview_tab->web_contents()->GetWebUI()->GetController()); | 539 preview_tab->web_contents()->GetWebUI()->GetController()); |
| 539 if (print_preview_ui) | 540 if (print_preview_ui) |
| 540 print_preview_ui->OnTabDestroyed(); | 541 print_preview_ui->OnTabDestroyed(); |
| 541 | 542 |
| 542 preview_tab_map_.erase(preview_tab); | 543 preview_tab_map_.erase(preview_tab); |
| 543 RemoveObservers(preview_tab); | 544 RemoveObservers(preview_tab); |
| 544 } | 545 } |
| 545 | 546 |
| 546 } // namespace printing | 547 } // namespace printing |
| OLD | NEW |