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