Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3849)

Unified Diff: chrome/browser/ui/webui/print_preview_handler.cc

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed style issues. Added check to see if there is enough space to print headers and footers. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e1455bd020df077375eba0be09c5bcb1f20c1a89..220126a28812510eaa087b9d6f0e3d6877b88107 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 displayHeaderFooter;
+ if (!settings->GetBoolean(printing::kSettingHeaderFooter,
+ &displayHeaderFooter)) {
+ NOTREACHED();
+ }
+
+ // If headers and footers option is checked then we retrieve the page title
+ // and url and send it to the renderer process.
+ DictionaryValue header_footer_info;
+ if (displayHeaderFooter) {
+ header_footer_info.SetString(printing::kSettingHeaderFooterTitle,
vandebo (ex-Chrome) 2011/07/19 21:31:20 Why not just put this in settings?
vandebo (ex-Chrome) 2011/07/22 22:58:33 You didn't address this comment.
Aayush Kumar 2011/07/24 02:09:02 Sorry about that - I somehow seemed to have missed
+ initiator_tab->GetTitle());
+
+ std::string footer_url;
vandebo (ex-Chrome) 2011/07/19 21:31:20 nit: url
Aayush Kumar 2011/07/24 02:09:02 Done.
+ NavigationEntry* entry = initiator_tab->controller().GetActiveEntry();
+ if (entry)
+ footer_url = entry->virtual_url().spec();
+
+ header_footer_info.SetString(printing::kSettingHeaderFooterURL,
+ footer_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) {

Powered by Google App Engine
This is Rietveld 408576698