| 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_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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 void PrintPreviewMessageHandler::OnPrintPreviewFailed(int document_cookie) { | 198 void PrintPreviewMessageHandler::OnPrintPreviewFailed(int document_cookie) { |
| 199 PrintPreviewUI* print_preview_ui = OnFailure(document_cookie); | 199 PrintPreviewUI* print_preview_ui = OnFailure(document_cookie); |
| 200 if (!print_preview_ui) | 200 if (!print_preview_ui) |
| 201 return; | 201 return; |
| 202 print_preview_ui->OnPrintPreviewFailed(); | 202 print_preview_ui->OnPrintPreviewFailed(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( | 205 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( |
| 206 const PageSizeMargins& page_layout_in_points, | 206 const PageSizeMargins& page_layout_in_points, |
| 207 bool has_custom_page_size_style) { | 207 bool has_custom_page_size_style, |
| 208 bool header_footer_applies) { |
| 208 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 209 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
| 209 if (!print_preview_tab || !print_preview_tab->web_contents()->GetWebUI()) | 210 if (!print_preview_tab || !print_preview_tab->web_contents()->GetWebUI()) |
| 210 return; | 211 return; |
| 211 | 212 |
| 212 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 213 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
| 213 print_preview_tab->web_contents()->GetWebUI()->GetController()); | 214 print_preview_tab->web_contents()->GetWebUI()->GetController()); |
| 214 print_preview_ui->OnDidGetDefaultPageLayout(page_layout_in_points, | 215 print_preview_ui->OnDidGetDefaultPageLayout(page_layout_in_points, |
| 215 has_custom_page_size_style); | 216 has_custom_page_size_style, |
| 217 header_footer_applies); |
| 216 } | 218 } |
| 217 | 219 |
| 218 void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) { | 220 void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) { |
| 219 // Always need to stop the worker. | 221 // Always need to stop the worker. |
| 220 StopWorker(document_cookie); | 222 StopWorker(document_cookie); |
| 221 } | 223 } |
| 222 | 224 |
| 223 void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) { | 225 void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) { |
| 224 PrintPreviewUI* print_preview_ui = OnFailure(document_cookie); | 226 PrintPreviewUI* print_preview_ui = OnFailure(document_cookie); |
| 225 if (!print_preview_ui) | 227 if (!print_preview_ui) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 return; | 266 return; |
| 265 } | 267 } |
| 266 // If |tab| is navigating and it has a print preview tab, notify |tab| to | 268 // If |tab| is navigating and it has a print preview tab, notify |tab| to |
| 267 // consider print preview done so it unfreezes the renderer in the case of | 269 // consider print preview done so it unfreezes the renderer in the case of |
| 268 // window.print(). | 270 // window.print(). |
| 269 if (preview_tab) | 271 if (preview_tab) |
| 270 tab->print_view_manager()->PrintPreviewDone(); | 272 tab->print_view_manager()->PrintPreviewDone(); |
| 271 } | 273 } |
| 272 | 274 |
| 273 } // namespace printing | 275 } // namespace printing |
| OLD | NEW |