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

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: Added Headers and Footers support - New Snapshot Uploaded 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 55ffe15a0c4451fcbe7414c35ccd24e5b5dbfd17..408707bee047eda0851f49bb1423444c88c4a6a8 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -14,7 +14,6 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
-#include "base/values.h"
Lei Zhang 2011/07/12 22:04:50 Why did you remove this?
Aayush Kumar 2011/07/13 21:52:16 Done.
#include "chrome/browser/browser_process.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/printing/background_printing_manager.h"
@@ -449,9 +448,34 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) {
print_preview_ui->OnPrintPreviewFailed();
return;
}
+
+ bool isHeaderFooter;
+ if (!(settings.get())->GetBoolean(printing::kSettingHeaderFooter,
kmadhusu 2011/07/13 18:47:53 "(settings.get())->" == "settings->"
Aayush Kumar 2011/07/13 21:52:16 Done.
+ &isHeaderFooter))
Lei Zhang 2011/07/12 22:04:50 nit: indentation nit: braces around NOTREACHED()
Aayush Kumar 2011/07/13 21:52:16 Done.
+ 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
+ // 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)
Lei Zhang 2011/07/12 22:04:50 nit: braces
Aayush Kumar 2011/07/13 21:52:16 Done.
+ header_footer_info.SetString(printing::kSettingHeaderFooterURL,
+ entry->virtual_url().spec());
+ else
+ header_footer_info.SetString(printing::kSettingHeaderFooterURL, "");
+ }
+
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));
Lei Zhang 2011/07/12 22:04:50 nit: indentation
Aayush Kumar 2011/07/13 21:52:16 Done.
}
void PrintPreviewHandler::HandlePrint(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698