Chromium Code Reviews| Index: chrome/browser/ui/webui/print_preview_handler.cc |
| diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc |
| index 5e1c0aad2d9a924b6f9ba82ae42e17929bcdca20..43d0f13d81e13c60ea41b9de02485d28d2cfc4e0 100644 |
| --- a/chrome/browser/ui/webui/print_preview_handler.cc |
| +++ b/chrome/browser/ui/webui/print_preview_handler.cc |
| @@ -483,9 +483,33 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) { |
| print_preview_ui->OnPrintPreviewFailed(); |
| return; |
| } |
| + |
| + bool display_header_footer; |
| + if (!settings->GetBoolean(printing::kSettingHeaderFooter, |
| + &display_header_footer)) { |
| + NOTREACHED(); |
| + } |
| + |
| + // If headers and footers option is checked then retrieve the page title and |
| + // url and send it to the renderer process. |
| + DictionaryValue header_footer_info; |
| + if (display_header_footer) { |
| + header_footer_info.SetString(printing::kSettingHeaderFooterTitle, |
| + initiator_tab->GetTitle()); |
| + |
| + std::string url; |
| + NavigationEntry* entry = initiator_tab->controller().GetActiveEntry(); |
| + if (entry) |
| + url = entry->virtual_url().spec(); |
| + |
| + header_footer_info.SetString(printing::kSettingHeaderFooterURL, |
|
dpapad
2011/07/25 15:40:01
Should this statement be within "if (entry)" block
Aayush Kumar
2011/07/25 18:37:23
No :)
On 2011/07/25 15:40:01, dpapad wrote:
dpapad
2011/07/25 20:14:20
Please provide more info. Specifically, what happe
Aayush Kumar
2011/07/25 22:31:16
It turns out that the url can be an empty string,
|
| + url); |
| + } |
| + |
| VLOG(1) << "Print preview request start"; |
| RenderViewHost* rvh = initiator_tab->render_view_host(); |
| - rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); |
| + rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings, |
| + header_footer_info)); |
| } |
| void PrintPreviewHandler::HandlePrint(const ListValue* args) { |