| 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_message_handler.h" | 5 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/printing/print_job_manager.h" | 8 #include "chrome/browser/printing/print_job_manager.h" |
| 9 #include "chrome/browser/printing/print_preview_tab_controller.h" | 9 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 10 #include "chrome/browser/printing/print_view_manager.h" | 10 #include "chrome/browser/printing/print_view_manager.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 TabContentsWrapper* wrapper = | 74 TabContentsWrapper* wrapper = |
| 75 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); | 75 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); |
| 76 wrapper->print_view_manager()->OverrideTitle(tab_contents()); | 76 wrapper->print_view_manager()->OverrideTitle(tab_contents()); |
| 77 | 77 |
| 78 PrintPreviewUI* print_preview_ui = | 78 PrintPreviewUI* print_preview_ui = |
| 79 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 79 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
| 80 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); | 80 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); |
| 81 html_source->SetPrintPreviewData( | 81 html_source->SetPrintPreviewData( |
| 82 std::make_pair(shared_buf, params.data_size)); | 82 std::make_pair(shared_buf, params.data_size)); |
| 83 print_preview_ui->PreviewDataIsAvailable(params.expected_pages_count, | 83 print_preview_ui->PreviewDataIsAvailable( |
| 84 tab_contents()->GetTitle()); | 84 params.expected_pages_count, |
| 85 wrapper->print_view_manager()->RenderSourceName()); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { | 88 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { |
| 88 PrintPreviewTabController::PrintPreview(tab_contents()); | 89 PrintPreviewTabController::PrintPreview(tab_contents()); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void PrintPreviewMessageHandler::OnScriptInitiatedPrintPreview() { | 92 void PrintPreviewMessageHandler::OnScriptInitiatedPrintPreview() { |
| 92 PrintPreviewTabController::PrintPreview(tab_contents()); | 93 PrintPreviewTabController::PrintPreview(tab_contents()); |
| 93 } | 94 } |
| 94 | 95 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 } | 109 } |
| 109 | 110 |
| 110 void PrintPreviewMessageHandler::DidStartLoading() { | 111 void PrintPreviewMessageHandler::DidStartLoading() { |
| 111 if (tab_contents()->delegate() && | 112 if (tab_contents()->delegate() && |
| 112 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { | 113 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { |
| 113 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); | 114 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace printing | 118 } // namespace printing |
| OLD | NEW |