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

Side by Side Diff: printing/pdf_render_settings.h

Issue 2640033005: Substitute boolean GDI printing for a mode type (Closed)
Patch Set: Remove extra def in fuzzer Created 3 years, 10 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
OLDNEW
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 #endif
Nico 2017/01/26 20:46:05 nit: consider enum Mode { NORMAL, #if defined(O
rbpotter 2017/01/26 22:10:50 Done.
27 };
28
29 PdfRenderSettings() : dpi(0), autorotate(false), mode(Mode::NORMAL) {}
30 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate, Mode mode)
31 : area(area), dpi(dpi), autorotate(autorotate), mode(mode) {}
22 ~PdfRenderSettings() {} 32 ~PdfRenderSettings() {}
23 33
24 gfx::Rect area; 34 gfx::Rect area;
25 int dpi; 35 int dpi;
26 bool autorotate; 36 bool autorotate;
37 Mode mode;
27 }; 38 };
28 39
29 } // namespace printing 40 } // namespace printing
30 41
31 namespace IPC { 42 #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 43
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698