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