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