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_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 bool PrintViewManager::PrintNow() { | 83 bool PrintViewManager::PrintNow() { |
84 return PrintNowInternal(new PrintMsg_PrintPages(routing_id())); | 84 return PrintNowInternal(new PrintMsg_PrintPages(routing_id())); |
85 } | 85 } |
86 | 86 |
87 bool PrintViewManager::PrintForSystemDialogNow() { | 87 bool PrintViewManager::PrintForSystemDialogNow() { |
88 return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id())); | 88 return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id())); |
89 } | 89 } |
90 | 90 |
91 bool PrintViewManager::AdvancedPrintNow() { | 91 bool PrintViewManager::AdvancedPrintNow() { |
92 printing::PrintPreviewTabController* tab_controller = | 92 PrintPreviewTabController* tab_controller = |
93 printing::PrintPreviewTabController::GetInstance(); | 93 PrintPreviewTabController::GetInstance(); |
94 if (!tab_controller) | 94 if (!tab_controller) |
95 return false; | 95 return false; |
96 TabContents* print_preview_tab = | 96 TabContentsWrapper* wrapper = |
97 tab_controller->GetPrintPreviewForTab(tab_contents()); | 97 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents()); |
| 98 TabContentsWrapper* print_preview_tab = |
| 99 tab_controller->GetPrintPreviewForTab(wrapper); |
98 if (print_preview_tab) { | 100 if (print_preview_tab) { |
99 // Preview tab exist for current tab or current tab is preview tab. | 101 // Preview tab exist for current tab or current tab is preview tab. |
100 if (!print_preview_tab->web_ui()) | 102 if (!print_preview_tab->web_ui()) |
101 return false; | 103 return false; |
102 PrintPreviewUI* print_preview_ui = | 104 PrintPreviewUI* print_preview_ui = |
103 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 105 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
104 print_preview_ui->OnShowSystemDialog(); | 106 print_preview_ui->OnShowSystemDialog(); |
105 return true; | 107 return true; |
106 } else { | 108 } else { |
107 return PrintNow(); | 109 return PrintNow(); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 534 } |
533 | 535 |
534 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { | 536 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { |
535 // Don't print / print preview interstitials. | 537 // Don't print / print preview interstitials. |
536 if (tab_contents()->showing_interstitial_page()) | 538 if (tab_contents()->showing_interstitial_page()) |
537 return false; | 539 return false; |
538 return Send(message); | 540 return Send(message); |
539 } | 541 } |
540 | 542 |
541 } // namespace printing | 543 } // namespace printing |
OLD | NEW |