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

Side by Side Diff: printing/pdf_render_settings.h

Issue 1462443002: Mark base::Tuple as final (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « base/tuple.h ('k') | no next file » | 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) 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 "base/tuple.h" 8 #include "ipc/ipc_message_utils.h"
9 #include "ipc/ipc_param_traits.h" 9 #include "ipc/ipc_param_traits.h"
10 #include "printing/printing_export.h" 10 #include "printing/printing_export.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/ipc/gfx_param_traits.h"
12 13
13 namespace printing { 14 namespace printing {
14 15
15 // Defining PDF rendering settings here as a Tuple as following: 16 // Defining PDF rendering settings.
16 // gfx::Rect - render area 17 class PdfRenderSettings {
17 // int - render dpi
18 // bool - autorotate pages to fit paper
19 typedef base::Tuple<gfx::Rect, int, bool> PdfRenderSettingsBase;
20
21 class PdfRenderSettings : public PdfRenderSettingsBase {
22 public: 18 public:
23 PdfRenderSettings() : PdfRenderSettingsBase() {} 19 PdfRenderSettings() {}
24 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate) 20 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate)
25 : PdfRenderSettingsBase(area, dpi, autorotate) {} 21 : area_(area), dpi_(dpi), autorotate_(autorotate) {}
26 ~PdfRenderSettings() {} 22 ~PdfRenderSettings() {}
27 23
28 const gfx::Rect& area() const { return base::get<0>(*this); } 24 const gfx::Rect& area() const { return area_; }
29 int dpi() const { return base::get<1>(*this); } 25 int dpi() const { return dpi_; }
30 bool autorotate() const { return base::get<2>(*this); } 26 bool autorotate() const { return autorotate_; }
27
28 gfx::Rect area_;
29 int dpi_;
30 bool autorotate_;
31 }; 31 };
32 32
33 } // namespace printing 33 } // namespace printing
34 34
35 namespace IPC { 35 namespace IPC {
36 template <> 36 template <>
37 struct SimilarTypeTraits<printing::PdfRenderSettings> { 37 struct ParamTraits<printing::PdfRenderSettings> {
38 typedef printing::PdfRenderSettingsBase Type; 38 typedef printing::PdfRenderSettings param_type;
39 static void Write(Message* m, const param_type& p) {
40 WriteParam(m, p.area_);
41 WriteParam(m, p.dpi_);
42 WriteParam(m, p.autorotate_);
43 }
44
45 static bool Read(const Message* m, base::PickleIterator* iter,
46 param_type* r) {
47 return ReadParam(m, iter, &r->area_) &&
48 ReadParam(m, iter, &r->dpi_) &&
49 ReadParam(m, iter, &r->autorotate_);
50 }
51
52 static void Log(const param_type& p, std::string* l) {
53 LogParam(p.area_, l);
54 l->append(", ");
55 LogParam(p.dpi_, l);
56 l->append(", ");
57 LogParam(p.autorotate_, l);
58 }
39 }; 59 };
40 60
41 } // namespace IPC 61 } // namespace IPC
42 62
43 #endif // PRINTING_PDF_RENDER_SETTINGS_H_ 63 #endif // PRINTING_PDF_RENDER_SETTINGS_H_
44
OLDNEW
« no previous file with comments | « base/tuple.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698