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