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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/tuple.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_render_settings.h
diff --git a/printing/pdf_render_settings.h b/printing/pdf_render_settings.h
index 3f8f38bab3b0b844e25b0f0ac4faf69fafd40fac..a2e182e9f11a7c20c06533645e5164f21a8eea86 100644
--- a/printing/pdf_render_settings.h
+++ b/printing/pdf_render_settings.h
@@ -5,40 +5,59 @@
#ifndef PRINTING_PDF_RENDER_SETTINGS_H_
#define PRINTING_PDF_RENDER_SETTINGS_H_
-#include "base/tuple.h"
+#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_param_traits.h"
#include "printing/printing_export.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/ipc/gfx_param_traits.h"
namespace printing {
-// Defining PDF rendering settings here as a Tuple as following:
-// gfx::Rect - render area
-// int - render dpi
-// bool - autorotate pages to fit paper
-typedef base::Tuple<gfx::Rect, int, bool> PdfRenderSettingsBase;
-
-class PdfRenderSettings : public PdfRenderSettingsBase {
+// Defining PDF rendering settings.
+class PdfRenderSettings {
public:
- PdfRenderSettings() : PdfRenderSettingsBase() {}
+ PdfRenderSettings() {}
PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate)
- : PdfRenderSettingsBase(area, dpi, autorotate) {}
+ : area_(area), dpi_(dpi), autorotate_(autorotate) {}
~PdfRenderSettings() {}
- const gfx::Rect& area() const { return base::get<0>(*this); }
- int dpi() const { return base::get<1>(*this); }
- bool autorotate() const { return base::get<2>(*this); }
+ const gfx::Rect& area() const { return area_; }
+ int dpi() const { return dpi_; }
+ bool autorotate() const { return autorotate_; }
+
+ gfx::Rect area_;
+ int dpi_;
+ bool autorotate_;
};
} // namespace printing
namespace IPC {
template <>
-struct SimilarTypeTraits<printing::PdfRenderSettings> {
- typedef printing::PdfRenderSettingsBase Type;
+struct ParamTraits<printing::PdfRenderSettings> {
+ typedef printing::PdfRenderSettings param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.area_);
+ WriteParam(m, p.dpi_);
+ WriteParam(m, p.autorotate_);
+ }
+
+ static bool Read(const Message* m, base::PickleIterator* iter,
+ param_type* r) {
+ return ReadParam(m, iter, &r->area_) &&
+ ReadParam(m, iter, &r->dpi_) &&
+ ReadParam(m, iter, &r->autorotate_);
+ }
+
+ static void Log(const param_type& p, std::string* l) {
+ LogParam(p.area_, l);
+ l->append(", ");
+ LogParam(p.dpi_, l);
+ l->append(", ");
+ LogParam(p.autorotate_, l);
+ }
};
} // namespace IPC
#endif // PRINTING_PDF_RENDER_SETTINGS_H_
-
« 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