diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 06:06:58 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 06:06:58 +0000 |
commit | dcd1e88686edab52a5c9addc1c64b46826cfe79c (patch) | |
tree | f560f72fbe8584097c85822796ae6af2ca88b75f /printing/printed_document.cc | |
parent | ce80f5f9b5b2e8238875419a5adf61875524f3ef (diff) | |
download | chromium_src-dcd1e88686edab52a5c9addc1c64b46826cfe79c.zip chromium_src-dcd1e88686edab52a5c9addc1c64b46826cfe79c.tar.gz chromium_src-dcd1e88686edab52a5c9addc1c64b46826cfe79c.tar.bz2 |
Printing: Remove unused PageOverlay since header/footers are drawn in PrintWebViewHelper.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7585015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printed_document.cc')
-rw-r--r-- | printing/printed_document.cc | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/printing/printed_document.cc b/printing/printed_document.cc index 1f1d2af..7f2834e 100644 --- a/printing/printed_document.cc +++ b/printing/printed_document.cc @@ -19,7 +19,6 @@ #include "base/utf_string_conversions.h" #include "base/i18n/time_formatting.h" #include "printing/page_number.h" -#include "printing/page_overlays.h" #include "printing/printed_pages_source.h" #include "printing/printed_page.h" #include "printing/units.h" @@ -180,85 +179,11 @@ int PrintedDocument::expected_page_count() const { return mutable_.expected_page_count_; } -void PrintedDocument::PrintHeaderFooter(gfx::NativeDrawingContext context, - const PrintedPage& page, - PageOverlays::HorizontalPosition x, - PageOverlays::VerticalPosition y, - const gfx::Font& font) const { - const PrintSettings& settings = immutable_.settings_; - if (!settings.use_overlays || !page.has_visible_overlays()) { - return; - } - const std::wstring& line = settings.overlays.GetOverlay(x, y); - if (line.empty()) { - return; - } - std::wstring output(PageOverlays::ReplaceVariables(line, *this, page)); - if (output.empty()) { - // May happen if document name or url is empty. - return; - } - const gfx::Size string_size(font.GetStringWidth(WideToUTF16Hack(output)), - font.GetHeight()); - gfx::Rect bounding; - bounding.set_height(string_size.height()); - const gfx::Rect& overlay_area( - settings.page_setup_device_units().overlay_area()); - // Hard code .25 cm interstice between overlays. Make sure that some space is - // kept between each headers. - const int interstice = ConvertUnit(250, kHundrethsMMPerInch, - settings.device_units_per_inch()); - const int max_width = overlay_area.width() / 3 - interstice; - const int actual_width = std::min(string_size.width(), max_width); - switch (x) { - case PageOverlays::LEFT: - bounding.set_x(overlay_area.x()); - bounding.set_width(max_width); - break; - case PageOverlays::CENTER: - bounding.set_x(overlay_area.x() + - (overlay_area.width() - actual_width) / 2); - bounding.set_width(actual_width); - break; - case PageOverlays::RIGHT: - bounding.set_x(overlay_area.right() - actual_width); - bounding.set_width(actual_width); - break; - } - - DCHECK_LE(bounding.right(), overlay_area.right()); - - switch (y) { - case PageOverlays::BOTTOM: - bounding.set_y(overlay_area.bottom() - string_size.height()); - break; - case PageOverlays::TOP: - bounding.set_y(overlay_area.y()); - break; - } - - if (string_size.width() > bounding.width()) { - if (line == PageOverlays::kUrl) { - output = UTF16ToWideHack(ui::ElideUrl(url(), font, bounding.width(), - std::string())); - } else { - output = UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(output), - font, bounding.width(), false)); - } - } - - DrawHeaderFooter(context, output, bounding); -} - void PrintedDocument::DebugDump(const PrintedPage& page) { if (!g_debug_dump_info.Get().enabled) return; string16 filename; - filename += date(); - filename += ASCIIToUTF16("_"); - filename += time(); - filename += ASCIIToUTF16("_"); filename += name(); filename += ASCIIToUTF16("_"); filename += ASCIIToUTF16(StringPrintf("%02d", page.page_number())); @@ -303,7 +228,6 @@ PrintedDocument::Immutable::Immutable(const PrintSettings& settings, name_(source->RenderSourceName()), url_(source->RenderSourceUrl()), cookie_(cookie) { - SetDocumentDate(); } PrintedDocument::Immutable::~Immutable() { |