summaryrefslogtreecommitdiffstats
path: root/printing/printed_document.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 22:01:52 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 22:01:52 +0000
commite059878de96a6fcdc70dfc3bf13d37be6d1a697a (patch)
tree4387419d69b2946a556e43d52596c78c07582e17 /printing/printed_document.cc
parentcceaf8512b4cb70a81db1f371ae094e2f2d3f645 (diff)
downloadchromium_src-e059878de96a6fcdc70dfc3bf13d37be6d1a697a.zip
chromium_src-e059878de96a6fcdc70dfc3bf13d37be6d1a697a.tar.gz
chromium_src-e059878de96a6fcdc70dfc3bf13d37be6d1a697a.tar.bz2
Printing: Refactor a few helper methods implemented per-platform to clean up
ifdef mess in PrintedDocument implementation. BUG=none TEST=none Review URL: http://codereview.chromium.org/3564016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printed_document.cc')
-rw-r--r--printing/printed_document.cc42
1 files changed, 2 insertions, 40 deletions
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index f5989f6..2dad1a0 100644
--- a/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -17,7 +17,6 @@
#include "base/singleton.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "base/time.h"
#include "base/i18n/time_formatting.h"
#include "gfx/font.h"
#include "printing/page_number.h"
@@ -27,12 +26,6 @@
#include "printing/units.h"
#include "skia/ext/platform_device.h"
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
-
-using base::Time;
-
namespace {
struct PrintDebugDumpPath {
@@ -245,25 +238,7 @@ void PrintedDocument::PrintHeaderFooter(gfx::NativeDrawingContext context,
}
}
- // TODO(stuartmorgan): Factor out this platform-specific part into another
- // method that can be moved into the platform files.
-#if defined(OS_WIN)
- // Save the state (again) for the clipping region.
- int saved_state = SaveDC(context);
- DCHECK_NE(saved_state, 0);
-
- int result = IntersectClipRect(context, bounding.x(), bounding.y(),
- bounding.right() + 1, bounding.bottom() + 1);
- DCHECK(result == SIMPLEREGION || result == COMPLEXREGION);
- TextOut(context,
- bounding.x(), bounding.y(),
- output.c_str(),
- static_cast<int>(output.size()));
- int res = RestoreDC(context, saved_state);
- DCHECK_NE(res, 0);
-#else // OS_WIN
- NOTIMPLEMENTED();
-#endif // OS_WIN
+ DrawHeaderFooter(context, output, bounding);
}
void PrintedDocument::DebugDump(const PrintedPage& page) {
@@ -314,20 +289,7 @@ PrintedDocument::Immutable::Immutable(const PrintSettings& settings,
name_(source->RenderSourceName()),
url_(source->RenderSourceUrl()),
cookie_(cookie) {
- // Setup the document's date.
-#if defined(OS_WIN)
- // On Windows, use the native time formatting for printing.
- SYSTEMTIME systemtime;
- GetLocalTime(&systemtime);
- date_ =
- WideToUTF16Hack(win_util::FormatSystemDate(systemtime, std::wstring()));
- time_ =
- WideToUTF16Hack(win_util::FormatSystemTime(systemtime, std::wstring()));
-#else // OS_WIN
- Time now = Time::Now();
- date_ = WideToUTF16Hack(base::TimeFormatShortDateNumeric(now));
- time_ = WideToUTF16Hack(base::TimeFormatTimeOfDay(now));
-#endif // OS_WIN
+ SetDocumentDate();
}
PrintedDocument::Immutable::~Immutable() {