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

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: Indent Fix 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 4206b4bfd25f5a89436c0461ce12b408dd64bc2d..1ff602c169e3d41f60c0343aa1012660e35471a9 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -483,9 +483,35 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) {
print_preview_ui->OnPrintPreviewFailed();
return;
}
+
+ bool isHeaderFooter;
+ if (!settings->GetBoolean(printing::kSettingHeaderFooter, &isHeaderFooter)) {
kmadhusu 2011/07/14 01:50:15 nit: Remove {} http://google-styleguide.googlecode
Aayush Kumar 2011/07/19 01:20:30 It's now a multi-line if condition so braces have
+ NOTREACHED();
+ }
+
+ // If the user has checked the Headers and footers option then we go ahead
+ // and retrieve the page URL and title since we're already in the browser
+ // process and send it along to the renderer along with other print settings.
+ // No point going back to the renderer and then making an explicit call to
kmadhusu 2011/07/14 01:50:15 Provide a simple comment. No need to specify any d
Aayush Kumar 2011/07/19 01:20:30 Done.
+ // the browser process again to retrieve this information.
+ DictionaryValue header_footer_info;
+ if (isHeaderFooter) {
+ header_footer_info.SetString(printing::kSettingHeaderFooterTitle,
+ initiator_tab->GetTitle());
+
+ NavigationEntry* entry = initiator_tab->controller().GetActiveEntry();
+ if (entry) {
+ header_footer_info.SetString(printing::kSettingHeaderFooterURL,
+ entry->virtual_url().spec());
+ } else {
+ header_footer_info.SetString(printing::kSettingHeaderFooterURL, "");
kmadhusu 2011/07/14 01:50:15 How about: std::string footer_url; NavigationEnt
Aayush Kumar 2011/07/19 01:20:30 Done.
+ }
+ }
+
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));
kmadhusu 2011/07/14 01:50:15 As thestig suggested, header_footer_info can be a
Aayush Kumar 2011/07/19 01:20:30 I discussed it with him and in person and put a sm
}
void PrintPreviewHandler::HandlePrint(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698