summaryrefslogtreecommitdiffstats
path: root/chrome/common/render_messages.h
diff options
context:
space:
mode:
authorhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 12:18:59 +0000
committerhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 12:18:59 +0000
commite290f741046d0d9c185ef7a2298d5c22ad96d52c (patch)
tree9451c2c3749abc439ff4fdad6114b2cc022be7c6 /chrome/common/render_messages.h
parentcddd06612c21272576a4d6bcdd16e53b054e71ff (diff)
downloadchromium_src-e290f741046d0d9c185ef7a2298d5c22ad96d52c.zip
chromium_src-e290f741046d0d9c185ef7a2298d5c22ad96d52c.tar.gz
chromium_src-e290f741046d0d9c185ef7a2298d5c22ad96d52c.tar.bz2
Expand print-related IPCs so we can implement CSS3 paged media.
The members added into ViewMsg_Print_Params will be used to tell printers' setting to renderer process. Maybe ViewMsg_Print_Params::printable_size should be printable_area, but I've just added margin_top and margin_left for now because printable_size is used from several code so I wanted to avoid a big change. The members added into ViewHostMsg_DidPrintPage_Params will be used to tell web authors' page setting to browser process. BUG=47277 TEST=none Review URL: http://codereview.chromium.org/2805045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r--chrome/common/render_messages.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index fc54b29..a08f109 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -367,9 +367,19 @@ struct ViewHostMsg_Resource_Request {
// Parameters for a render request.
struct ViewMsg_Print_Params {
+ // Physical size of the page, including non-printable margins,
+ // in pixels according to dpi.
+ gfx::Size page_size;
+
// In pixels according to dpi_x and dpi_y.
gfx::Size printable_size;
+ // The y-offset of the printable area, in pixels according to dpi.
+ int margin_top;
+
+ // The x-offset of the printable area, in pixels according to dpi.
+ int margin_left;
+
// Specifies dots per inch.
double dpi;
@@ -390,7 +400,10 @@ struct ViewMsg_Print_Params {
// Warning: do not compare document_cookie.
bool Equals(const ViewMsg_Print_Params& rhs) const {
- return printable_size == rhs.printable_size &&
+ return page_size == rhs.page_size &&
+ printable_size == rhs.printable_size &&
+ margin_top == rhs.margin_top &&
+ margin_left == rhs.margin_left &&
dpi == rhs.dpi &&
min_shrink == rhs.min_shrink &&
max_shrink == rhs.max_shrink &&
@@ -401,7 +414,8 @@ struct ViewMsg_Print_Params {
// Checking if the current params is empty. Just initialized after a memset.
bool IsEmpty() const {
return !document_cookie && !desired_dpi && !max_shrink && !min_shrink &&
- !dpi && printable_size.IsEmpty() && !selection_only;
+ !dpi && printable_size.IsEmpty() && !selection_only &&
+ page_size.IsEmpty() && !margin_top && !margin_left;
}
};
@@ -441,6 +455,12 @@ struct ViewHostMsg_DidPrintPage_Params {
// Shrink factor used to render this page.
double actual_shrink;
+
+ // The size of the page the page author specified.
+ gfx::Size page_size;
+
+ // The printable area the page author specified.
+ gfx::Rect content_area;
};
// Parameters for creating an audio output stream.
@@ -1485,7 +1505,10 @@ template <>
struct ParamTraits<ViewMsg_Print_Params> {
typedef ViewMsg_Print_Params param_type;
static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.page_size);
WriteParam(m, p.printable_size);
+ WriteParam(m, p.margin_top);
+ WriteParam(m, p.margin_left);
WriteParam(m, p.dpi);
WriteParam(m, p.min_shrink);
WriteParam(m, p.max_shrink);
@@ -1494,7 +1517,10 @@ struct ParamTraits<ViewMsg_Print_Params> {
WriteParam(m, p.selection_only);
}
static bool Read(const Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->printable_size) &&
+ return ReadParam(m, iter, &p->page_size) &&
+ ReadParam(m, iter, &p->printable_size) &&
+ ReadParam(m, iter, &p->margin_top) &&
+ ReadParam(m, iter, &p->margin_left) &&
ReadParam(m, iter, &p->dpi) &&
ReadParam(m, iter, &p->min_shrink) &&
ReadParam(m, iter, &p->max_shrink) &&
@@ -1551,13 +1577,17 @@ struct ParamTraits<ViewHostMsg_DidPrintPage_Params> {
WriteParam(m, p.document_cookie);
WriteParam(m, p.page_number);
WriteParam(m, p.actual_shrink);
+ WriteParam(m, p.page_size);
+ WriteParam(m, p.content_area);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->metafile_data_handle) &&
ReadParam(m, iter, &p->data_size) &&
ReadParam(m, iter, &p->document_cookie) &&
ReadParam(m, iter, &p->page_number) &&
- ReadParam(m, iter, &p->actual_shrink);
+ ReadParam(m, iter, &p->actual_shrink) &&
+ ReadParam(m, iter, &p->page_size) &&
+ ReadParam(m, iter, &p->content_area);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"<ViewHostMsg_DidPrintPage_Params>");