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

Side by Side Diff: chrome/browser/printing/printed_document.cc

Issue 113441: ChromeFont->gfx::Font... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/printing/printed_document.h ('k') | chrome/browser/shell_dialogs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/printed_document.h" 5 #include "chrome/browser/printing/printed_document.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/gfx/chrome_font.h" 9 #include "app/gfx/chrome_font.h"
10 #include "app/gfx/text_elider.h" 10 #include "app/gfx/text_elider.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 if (!page.emf()->SafePlayback(context)) { 124 if (!page.emf()->SafePlayback(context)) {
125 NOTREACHED(); 125 NOTREACHED();
126 } 126 }
127 127
128 res = RestoreDC(context, saved_state); 128 res = RestoreDC(context, saved_state);
129 DCHECK_NE(res, 0); 129 DCHECK_NE(res, 0);
130 } 130 }
131 131
132 // Print the header and footer. 132 // Print the header and footer.
133 int base_font_size = ChromeFont().height(); 133 int base_font_size = gfx::Font().height();
134 int new_font_size = ConvertUnit(10, 134 int new_font_size = ConvertUnit(10,
135 immutable_.settings_.desired_dpi, 135 immutable_.settings_.desired_dpi,
136 immutable_.settings_.dpi()); 136 immutable_.settings_.dpi());
137 DCHECK_GT(new_font_size, base_font_size); 137 DCHECK_GT(new_font_size, base_font_size);
138 ChromeFont font(ChromeFont().DeriveFont(new_font_size - base_font_size)); 138 gfx::Font font(gfx::Font().DeriveFont(new_font_size - base_font_size));
139 HGDIOBJ old_font = SelectObject(context, font.hfont()); 139 HGDIOBJ old_font = SelectObject(context, font.hfont());
140 DCHECK(old_font != NULL); 140 DCHECK(old_font != NULL);
141 // We don't want a white square around the text ever if overflowing. 141 // We don't want a white square around the text ever if overflowing.
142 SetBkMode(context, TRANSPARENT); 142 SetBkMode(context, TRANSPARENT);
143 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::TOP, 143 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::TOP,
144 font); 144 font);
145 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::TOP, 145 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::TOP,
146 font); 146 font);
147 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::TOP, 147 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::TOP,
148 font); 148 font);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 int PrintedDocument::expected_page_count() const { 258 int PrintedDocument::expected_page_count() const {
259 AutoLock lock(lock_); 259 AutoLock lock(lock_);
260 return mutable_.expected_page_count_; 260 return mutable_.expected_page_count_;
261 } 261 }
262 262
263 void PrintedDocument::PrintHeaderFooter(HDC context, 263 void PrintedDocument::PrintHeaderFooter(HDC context,
264 const PrintedPage& page, 264 const PrintedPage& page,
265 PageOverlays::HorizontalPosition x, 265 PageOverlays::HorizontalPosition x,
266 PageOverlays::VerticalPosition y, 266 PageOverlays::VerticalPosition y,
267 const ChromeFont& font) const { 267 const gfx::Font& font) const {
268 const PrintSettings& settings = immutable_.settings_; 268 const PrintSettings& settings = immutable_.settings_;
269 const std::wstring& line = settings.overlays.GetOverlay(x, y); 269 const std::wstring& line = settings.overlays.GetOverlay(x, y);
270 if (line.empty()) { 270 if (line.empty()) {
271 return; 271 return;
272 } 272 }
273 std::wstring output(PageOverlays::ReplaceVariables(line, *this, page)); 273 std::wstring output(PageOverlays::ReplaceVariables(line, *this, page));
274 if (output.empty()) { 274 if (output.empty()) {
275 // May happens if document name or url is empty. 275 // May happens if document name or url is empty.
276 return; 276 return;
277 } 277 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 date_ = win_util::FormatSystemDate(systemtime, std::wstring()); 371 date_ = win_util::FormatSystemDate(systemtime, std::wstring());
372 time_ = win_util::FormatSystemTime(systemtime, std::wstring()); 372 time_ = win_util::FormatSystemTime(systemtime, std::wstring());
373 #else 373 #else
374 Time now = Time::Now(); 374 Time now = Time::Now();
375 date_ = TimeFormat::ShortDateNumeric(now); 375 date_ = TimeFormat::ShortDateNumeric(now);
376 time_ = TimeFormat::TimeOfDay(now); 376 time_ = TimeFormat::TimeOfDay(now);
377 #endif // WIN32 377 #endif // WIN32
378 } 378 }
379 379
380 } // namespace printing 380 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/printed_document.h ('k') | chrome/browser/shell_dialogs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698