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