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

Unified Diff: printing/printed_document.cc

Issue 193086: Fix printing project on linux. (Closed)
Patch Set: fix git error Created 11 years, 3 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 | « printing/pdf_ps_metafile_linux_unittest.cc ('k') | printing/printing.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printed_document.cc
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index b1d2332b2f4a47a44d837d2d1431547f56862524..918c99e6067aacba9a97bb8008e3d411123077c4 100644
--- a/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -8,12 +8,12 @@
#include "app/gfx/font.h"
#include "app/gfx/text_elider.h"
-#include "app/win_util.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/singleton.h"
#include "base/string_util.h"
#include "base/time.h"
+#include "base/time_format.h"
#include "printing/page_number.h"
#include "printing/page_overlays.h"
#include "printing/printed_pages_source.h"
@@ -21,6 +21,10 @@
#include "printing/units.h"
#include "skia/ext/platform_device.h"
+#if defined(OS_WIN)
+#include "app/win_util.h"
+#endif
+
using base::Time;
namespace {
@@ -36,6 +40,7 @@ struct PrintDebugDumpPath {
Singleton<PrintDebugDumpPath> g_debug_dump_info;
+#if defined(OS_WIN)
void SimpleModifyWorldTransform(HDC context,
int offset_x,
int offset_y,
@@ -51,6 +56,7 @@ void SimpleModifyWorldTransform(HDC context,
void DrawRect(HDC context, gfx::Rect rect) {
Rectangle(context, rect.x(), rect.y(), rect.right(), rect.bottom());
}
+#endif // OS_WIN
} // namespace
@@ -118,6 +124,7 @@ void PrintedDocument::RenderPrintedPage(const PrintedPage& page,
}
#endif
+#if defined(OS_WIN)
const printing::PageSetup& page_setup(
immutable_.settings_.page_setup_pixels());
@@ -206,6 +213,9 @@ void PrintedDocument::RenderPrintedPage(const PrintedPage& page,
font);
int res = RestoreDC(context, saved_state);
DCHECK_NE(res, 0);
+#else // OS_WIN
+ NOTIMPLEMENTED();
+#endif // OS_WIN
}
bool PrintedDocument::RenderPrintedPageNumber(int page_number, HDC context) {
@@ -238,7 +248,7 @@ void PrintedDocument::DisconnectSource() {
}
size_t PrintedDocument::MemoryUsage() const {
- std::vector<scoped_refptr<PrintedPage>> pages_copy;
+ std::vector< scoped_refptr<PrintedPage> > pages_copy;
{
AutoLock lock(lock_);
pages_copy.reserve(mutable_.pages_.size());
@@ -339,6 +349,7 @@ void PrintedDocument::PrintHeaderFooter(HDC context,
}
}
+#if defined(OS_WIN)
// Save the state (again) for the clipping region.
int saved_state = SaveDC(context);
DCHECK_NE(saved_state, 0);
@@ -352,6 +363,9 @@ void PrintedDocument::PrintHeaderFooter(HDC context,
static_cast<int>(output.size()));
int res = RestoreDC(context, saved_state);
DCHECK_NE(res, 0);
+#else // OS_WIN
+ NOTIMPLEMENTED();
+#endif // OS_WIN
}
void PrintedDocument::DebugDump(const PrintedPage& page) {
@@ -370,7 +384,11 @@ void PrintedDocument::DebugDump(const PrintedPage& page) {
file_util::ReplaceIllegalCharacters(&filename, '_');
std::wstring path(g_debug_dump_info->debug_dump_path);
file_util::AppendToPath(&path, filename);
+#if defined(OS_WIN)
page.native_metafile()->SaveTo(path);
+#else // OS_WIN
+ NOTIMPLEMENTED();
+#endif // OS_WIN
}
void PrintedDocument::set_debug_dump_path(const std::wstring& debug_dump_path) {
@@ -398,17 +416,17 @@ PrintedDocument::Immutable::Immutable(const PrintSettings& settings,
url_(source->RenderSourceUrl()),
cookie_(cookie) {
// Setup the document's date.
-#ifdef WIN32
+#if defined(OS_WIN)
// On Windows, use the native time formatting for printing.
SYSTEMTIME systemtime;
GetLocalTime(&systemtime);
date_ = win_util::FormatSystemDate(systemtime, std::wstring());
time_ = win_util::FormatSystemTime(systemtime, std::wstring());
-#else
+#else // OS_WIN
Time now = Time::Now();
- date_ = TimeFormat::ShortDateNumeric(now);
- time_ = TimeFormat::TimeOfDay(now);
-#endif // WIN32
+ date_ = base::TimeFormatShortDateNumeric(now);
+ time_ = base::TimeFormatTimeOfDay(now);
+#endif // OS_WIN
}
} // namespace printing
« no previous file with comments | « printing/pdf_ps_metafile_linux_unittest.cc ('k') | printing/printing.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698