diff options
Diffstat (limited to 'chrome/browser/ui')
| -rw-r--r-- | chrome/browser/ui/webui/print_preview_data_source.cc | 3 | ||||
| -rw-r--r-- | chrome/browser/ui/webui/print_preview_handler.cc | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/ui/webui/print_preview_data_source.cc b/chrome/browser/ui/webui/print_preview_data_source.cc index bc4d694..084f904 100644 --- a/chrome/browser/ui/webui/print_preview_data_source.cc +++ b/chrome/browser/ui/webui/print_preview_data_source.cc @@ -95,6 +95,9 @@ PrintPreviewDataSource::PrintPreviewDataSource() AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE); AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE); AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); + AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); + AddLocalizedString("optionHeaderFooter", + IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); set_json_path("strings.js"); add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS); diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc index 3aae34e..d904c18 100644 --- a/chrome/browser/ui/webui/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview_handler.cc @@ -493,6 +493,24 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) { print_preview_ui->OnPrintPreviewFailed(); return; } + + // Retrieve the page title and url and send it to the renderer process if + // headers and footers are to be displayed. + bool display_header_footer = false; + if (!settings->GetBoolean(printing::kSettingHeaderFooterEnabled, + &display_header_footer)) { + NOTREACHED(); + } + if (display_header_footer) { + settings->SetString(printing::kSettingHeaderFooterTitle, + initiator_tab->GetTitle()); + std::string url; + NavigationEntry* entry = initiator_tab->controller().GetActiveEntry(); + if (entry) + url = entry->virtual_url().spec(); + settings->SetString(printing::kSettingHeaderFooterURL, url); + } + VLOG(1) << "Print preview request start"; RenderViewHost* rvh = initiator_tab->render_view_host(); rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); @@ -522,6 +540,8 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) { bool print_to_pdf = false; settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); + settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false); + TabContentsWrapper* preview_tab_wrapper = TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
