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

Unified Diff: printing/print_settings_initializer.cc

Issue 11359020: Print headers and footers with WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « printing/print_job_constants.cc ('k') | printing/units.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/print_settings_initializer.cc
diff --git a/printing/print_settings_initializer.cc b/printing/print_settings_initializer.cc
index e82bbfcdc08664732123b6884878b2084d5920e8..c49a5568dc8e5d43871cc4548fc9959de351e102 100644
--- a/printing/print_settings_initializer.cc
+++ b/printing/print_settings_initializer.cc
@@ -35,34 +35,15 @@ void PrintSettingsInitializer::InitHeaderFooterStrings(
string16 date = base::TimeFormatShortDateNumeric(base::Time::Now());
string16 title;
- std::string url;
+ string16 url;
if (!job_settings.GetString(kSettingHeaderFooterTitle, &title) ||
!job_settings.GetString(kSettingHeaderFooterURL, &url)) {
NOTREACHED();
}
- gfx::Font font(
- kSettingHeaderFooterFontName,
- ceil(ConvertPointsToPixelDouble(kSettingHeaderFooterFontSize)));
- double segment_width = GetHeaderFooterSegmentWidth(ConvertUnitDouble(
- print_settings->page_setup_device_units().physical_size().width(),
- print_settings->device_units_per_inch(), kPixelsPerInch));
- date = ui::ElideText(date, font, segment_width, ui::ELIDE_AT_END);
print_settings->date = date;
-
- // Calculate the available title width. If the date string is not long
- // enough, increase the available space for the title.
- // Assumes there is no header text to RIGHT of title.
- double date_width = font.GetStringWidth(date);
- double max_title_width = std::min(2 * segment_width,
- 2 * (segment_width - date_width) +
- segment_width);
- print_settings->title =
- ui::ElideText(title, font, max_title_width, ui::ELIDE_AT_END);
-
- double max_url_width = 2 * segment_width;
- GURL gurl(url);
- print_settings->url = ui::ElideUrl(gurl, font, max_url_width, std::string());
+ print_settings->title = title;
+ print_settings->url = ui::ElideUrl(GURL(url), gfx::Font(), 0, std::string());
}
} // namespace printing
« no previous file with comments | « printing/print_job_constants.cc ('k') | printing/units.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698