OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef PRINTING_PDF_RENDER_SETTINGS_H_ | 5 #ifndef PRINTING_PDF_RENDER_SETTINGS_H_ |
6 #define PRINTING_PDF_RENDER_SETTINGS_H_ | 6 #define PRINTING_PDF_RENDER_SETTINGS_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "ipc/ipc_message_macros.h" |
8 #include "ipc/ipc_message_utils.h" | 11 #include "ipc/ipc_message_utils.h" |
9 #include "ipc/ipc_param_traits.h" | 12 #include "ipc/ipc_param_traits.h" |
10 #include "printing/printing_export.h" | 13 #include "printing/printing_export.h" |
11 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" | 15 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" |
13 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" | 16 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" |
14 | 17 |
15 namespace printing { | 18 namespace printing { |
16 | 19 |
17 // Defining PDF rendering settings. | 20 // Defining PDF rendering settings. |
18 struct PdfRenderSettings { | 21 struct PdfRenderSettings { |
19 PdfRenderSettings() : dpi(0), autorotate(false) {} | 22 enum Mode { |
20 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate) | 23 NORMAL = 0, |
21 : area(area), dpi(dpi), autorotate(autorotate) {} | 24 #if defined(OS_WIN) |
| 25 GDI_TEXT, |
| 26 LAST = GDI_TEXT, |
| 27 #else |
| 28 LAST = NORMAL, |
| 29 #endif |
| 30 }; |
| 31 |
| 32 PdfRenderSettings() : dpi(0), autorotate(false), mode(Mode::NORMAL) {} |
| 33 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate, Mode mode) |
| 34 : area(area), dpi(dpi), autorotate(autorotate), mode(mode) {} |
22 ~PdfRenderSettings() {} | 35 ~PdfRenderSettings() {} |
23 | 36 |
24 gfx::Rect area; | 37 gfx::Rect area; |
25 int dpi; | 38 int dpi; |
26 bool autorotate; | 39 bool autorotate; |
| 40 Mode mode; |
27 }; | 41 }; |
28 | 42 |
29 } // namespace printing | 43 } // namespace printing |
30 | 44 |
31 namespace IPC { | 45 #endif // PRINTING_PDF_RENDER_SETTINGS_H_ |
32 template <> | |
33 struct ParamTraits<printing::PdfRenderSettings> { | |
34 typedef printing::PdfRenderSettings param_type; | |
35 static void Write(base::Pickle* m, const param_type& p) { | |
36 WriteParam(m, p.area); | |
37 WriteParam(m, p.dpi); | |
38 WriteParam(m, p.autorotate); | |
39 } | |
40 | 46 |
41 static bool Read(const base::Pickle* m, | |
42 base::PickleIterator* iter, | |
43 param_type* r) { | |
44 return ReadParam(m, iter, &r->area) && | |
45 ReadParam(m, iter, &r->dpi) && | |
46 ReadParam(m, iter, &r->autorotate); | |
47 } | |
48 | |
49 static void Log(const param_type& p, std::string* l) { | |
50 LogParam(p.area, l); | |
51 l->append(", "); | |
52 LogParam(p.dpi, l); | |
53 l->append(", "); | |
54 LogParam(p.autorotate, l); | |
55 } | |
56 }; | |
57 | |
58 } // namespace IPC | |
59 | |
60 #endif // PRINTING_PDF_RENDER_SETTINGS_H_ | |
OLD | NEW |