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) { |