Chromium Code Reviews| 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/printer_query.h" | 11 #include "chrome/browser/printing/printer_query.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
| 11 #include "chrome/browser/ui/webui/print_preview_handler.h" | 13 #include "chrome/browser/ui/webui/print_preview_handler.h" |
| 12 #include "chrome/browser/ui/webui/print_preview_ui.h" | 14 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 13 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h" | 15 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h" |
| 14 #include "chrome/common/content_restriction.h" | 16 #include "chrome/common/content_restriction.h" |
| 15 #include "chrome/common/print_messages.h" | 17 #include "chrome/common/print_messages.h" |
| 16 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
| 17 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 19 | 21 |
| 20 namespace printing { | 22 namespace printing { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 return; | 64 return; |
| 63 | 65 |
| 64 base::SharedMemory* shared_buf = | 66 base::SharedMemory* shared_buf = |
| 65 new base::SharedMemory(params.metafile_data_handle, true); | 67 new base::SharedMemory(params.metafile_data_handle, true); |
| 66 if (!shared_buf->Map(params.data_size)) { | 68 if (!shared_buf->Map(params.data_size)) { |
| 67 NOTREACHED(); | 69 NOTREACHED(); |
| 68 delete shared_buf; | 70 delete shared_buf; |
| 69 return; | 71 return; |
| 70 } | 72 } |
| 71 | 73 |
| 74 TabContentsWrapper* wrapper = | |
| 75 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); | |
| 76 wrapper->print_view_manager()->OverrideTitleAndUrl(tab_contents()); | |
|
kmadhusu
2011/03/31 22:37:48
if (wrapper)
wrapper->print_view_manager()->Over
Lei Zhang
2011/03/31 22:42:40
avi: Would we ever run into a case where |wrapper|
Avi (use Gerrit)
2011/04/06 11:21:32
No. Only in oddball testing situations.
| |
| 77 | |
| 72 PrintPreviewUI* print_preview_ui = | 78 PrintPreviewUI* print_preview_ui = |
| 73 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 79 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
| 74 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); | 80 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); |
| 75 html_source->SetPrintPreviewData( | 81 html_source->SetPrintPreviewData( |
| 76 std::make_pair(shared_buf, params.data_size)); | 82 std::make_pair(shared_buf, params.data_size)); |
| 77 print_preview_ui->PreviewDataIsAvailable(params.expected_pages_count, | 83 print_preview_ui->PreviewDataIsAvailable(params.expected_pages_count, |
| 78 tab_contents()->GetTitle()); | 84 tab_contents()->GetTitle()); |
| 79 } | 85 } |
| 80 | 86 |
| 81 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { | 87 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 102 } | 108 } |
| 103 | 109 |
| 104 void PrintPreviewMessageHandler::DidStartLoading() { | 110 void PrintPreviewMessageHandler::DidStartLoading() { |
| 105 if (tab_contents()->delegate() && | 111 if (tab_contents()->delegate() && |
| 106 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { | 112 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { |
| 107 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); | 113 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); |
| 108 } | 114 } |
| 109 } | 115 } |
| 110 | 116 |
| 111 } // namespace printing | 117 } // namespace printing |
| OLD | NEW |