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

Unified Diff: chrome/renderer/print_web_view_helper.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/common/print_messages.h ('k') | chrome/renderer/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper.cc
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index 5352be313bf617cb8c791af05d0d9de614a5b17c..ba7be1bea79902b0642d5d133a127912ef65132d 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -35,6 +35,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/rect.h"
#include "webkit/glue/webpreferences.h"
#if defined(OS_POSIX)
@@ -873,14 +874,27 @@ bool PrintWebViewHelper::CreatePreviewDocument() {
ComputePageLayoutInPointsForCss(print_preview_context_.frame(), 0,
print_params, ignore_css_margins_,
fit_to_page_, NULL, &default_page_layout);
+
if (!old_print_pages_params_.get() ||
!PageLayoutIsEqual(*old_print_pages_params_, *print_pages_params_)) {
bool has_page_size_style = PrintingFrameHasPageSizeStyle(
print_preview_context_.frame(),
print_preview_context_.total_page_count());
+ int dpi = GetDPI(&print_params);
+ gfx::Rect printable_area_in_points(
+ ConvertUnit(print_pages_params_->params.printable_area.x(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.y(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.width(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.height(),
+ dpi, printing::kPointsPerInch));
+
// Margins: Send default page layout to browser process.
Send(new PrintHostMsg_DidGetDefaultPageLayout(routing_id(),
default_page_layout,
+ printable_area_in_points,
has_page_size_style));
}
« no previous file with comments | « chrome/common/print_messages.h ('k') | chrome/renderer/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698