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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.cc

Issue 9699040: PrintPreview: Hide/Show the header footer option based on print frame margins. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 8 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_ui.h ('k') | chrome/common/print_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview/print_preview_ui.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index c1c204350329e4baca4583b181b4bf5f452eac9c..7c410918ae5b2776a67499dad160f1f70cffc40f 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -24,6 +24,7 @@
#include "content/public/browser/web_contents.h"
#include "printing/page_size_margins.h"
#include "printing/print_job_constants.h"
+#include "ui/gfx/rect.h"
using content::WebContents;
using printing::PageSizeMargins;
@@ -206,10 +207,12 @@ void PrintPreviewUI::OnDidGetPreviewPageCount(
}
void PrintPreviewUI::OnDidGetDefaultPageLayout(
- const PageSizeMargins& page_layout, bool has_custom_page_size_style) {
+ const PageSizeMargins& page_layout, const gfx::Rect& printable_area,
+ bool has_custom_page_size_style) {
if (page_layout.margin_top < 0 || page_layout.margin_left < 0 ||
page_layout.margin_bottom < 0 || page_layout.margin_right < 0 ||
- page_layout.content_width < 0 || page_layout.content_height < 0) {
+ page_layout.content_width < 0 || page_layout.content_height < 0 ||
+ printable_area.width() <= 0 || printable_area.height() <= 0) {
NOTREACHED();
return;
}
@@ -221,6 +224,12 @@ void PrintPreviewUI::OnDidGetDefaultPageLayout(
layout.SetDouble(printing::kSettingMarginRight, page_layout.margin_right);
layout.SetDouble(printing::kSettingContentWidth, page_layout.content_width);
layout.SetDouble(printing::kSettingContentHeight, page_layout.content_height);
+ layout.SetInteger(printing::kSettingPrintableAreaX, printable_area.x());
+ layout.SetInteger(printing::kSettingPrintableAreaY, printable_area.y());
+ layout.SetInteger(printing::kSettingPrintableAreaWidth,
+ printable_area.width());
+ layout.SetInteger(printing::kSettingPrintableAreaHeight,
+ printable_area.height());
base::FundamentalValue has_page_size_style(has_custom_page_size_style);
web_ui()->CallJavascriptFunction("onDidGetDefaultPageLayout", layout,
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_ui.h ('k') | chrome/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698