| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!print_preview_tab) | 106 if (!print_preview_tab) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 PrintPreviewUI* print_preview_ui = | 109 PrintPreviewUI* print_preview_ui = |
| 110 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 110 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
| 111 | 111 |
| 112 TabContentsWrapper* wrapper = | 112 TabContentsWrapper* wrapper = |
| 113 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); | 113 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); |
| 114 | 114 |
| 115 if (params.reuse_existing_data) { | 115 if (params.reuse_existing_data) { |
| 116 // Need to match normal rendering where we are expected to send this. |
| 117 print_preview_ui->OnDidGetPreviewPageCount(params.expected_pages_count); |
| 118 |
| 116 print_preview_ui->OnPreviewDataIsAvailable( | 119 print_preview_ui->OnPreviewDataIsAvailable( |
| 117 params.expected_pages_count, | 120 params.expected_pages_count, |
| 118 wrapper->print_view_manager()->RenderSourceName(), | 121 wrapper->print_view_manager()->RenderSourceName(), |
| 119 params.modifiable); | 122 params.modifiable); |
| 120 return; | 123 return; |
| 121 } | 124 } |
| 122 | 125 |
| 123 base::SharedMemory* shared_buf = | 126 base::SharedMemory* shared_buf = |
| 124 new base::SharedMemory(params.metafile_data_handle, true); | 127 new base::SharedMemory(params.metafile_data_handle, true); |
| 125 if (!shared_buf->Map(params.data_size)) { | 128 if (!shared_buf->Map(params.data_size)) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 208 } |
| 206 | 209 |
| 207 void PrintPreviewMessageHandler::DidStartLoading() { | 210 void PrintPreviewMessageHandler::DidStartLoading() { |
| 208 if (tab_contents()->delegate() && | 211 if (tab_contents()->delegate() && |
| 209 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { | 212 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { |
| 210 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); | 213 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); |
| 211 } | 214 } |
| 212 } | 215 } |
| 213 | 216 |
| 214 } // namespace printing | 217 } // namespace printing |
| OLD | NEW |