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

Side by Side Diff: chrome/common/render_messages.h

Issue 2805045: Expand print-related IPCs so we can implement CSS3 paged media. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: use page_size as suggested Created 10 years, 5 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
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_COMMON_RENDER_MESSAGES_H_ 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ 6 #define CHROME_COMMON_RENDER_MESSAGES_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 // Contains the id of the host renderer. 361 // Contains the id of the host renderer.
362 int host_renderer_id; 362 int host_renderer_id;
363 363
364 // Contains the id of the host render view. 364 // Contains the id of the host render view.
365 int host_render_view_id; 365 int host_render_view_id;
366 }; 366 };
367 367
368 // Parameters for a render request. 368 // Parameters for a render request.
369 struct ViewMsg_Print_Params { 369 struct ViewMsg_Print_Params {
370 // Physical size of the page, including non-printable margins,
371 // in pixels according to dpi.
372 gfx::Size page_size;
373
370 // In pixels according to dpi_x and dpi_y. 374 // In pixels according to dpi_x and dpi_y.
371 gfx::Size printable_size; 375 gfx::Size printable_size;
372 376
377 // The y-offset of the printable area, in pixels according to dpi.
378 int margin_top;
379
380 // The x-offset of the printable area, in pixels according to dpi.
381 int margin_left;
382
373 // Specifies dots per inch. 383 // Specifies dots per inch.
374 double dpi; 384 double dpi;
375 385
376 // Minimum shrink factor. See PrintSettings::min_shrink for more information. 386 // Minimum shrink factor. See PrintSettings::min_shrink for more information.
377 double min_shrink; 387 double min_shrink;
378 388
379 // Maximum shrink factor. See PrintSettings::max_shrink for more information. 389 // Maximum shrink factor. See PrintSettings::max_shrink for more information.
380 double max_shrink; 390 double max_shrink;
381 391
382 // Desired apparent dpi on paper. 392 // Desired apparent dpi on paper.
383 int desired_dpi; 393 int desired_dpi;
384 394
385 // Cookie for the document to ensure correctness. 395 // Cookie for the document to ensure correctness.
386 int document_cookie; 396 int document_cookie;
387 397
388 // Should only print currently selected text. 398 // Should only print currently selected text.
389 bool selection_only; 399 bool selection_only;
390 400
391 // Warning: do not compare document_cookie. 401 // Warning: do not compare document_cookie.
392 bool Equals(const ViewMsg_Print_Params& rhs) const { 402 bool Equals(const ViewMsg_Print_Params& rhs) const {
393 return printable_size == rhs.printable_size && 403 return page_size == rhs.page_size &&
404 printable_size == rhs.printable_size &&
405 margin_top == rhs.margin_top &&
406 margin_left == rhs.margin_left &&
394 dpi == rhs.dpi && 407 dpi == rhs.dpi &&
395 min_shrink == rhs.min_shrink && 408 min_shrink == rhs.min_shrink &&
396 max_shrink == rhs.max_shrink && 409 max_shrink == rhs.max_shrink &&
397 desired_dpi == rhs.desired_dpi && 410 desired_dpi == rhs.desired_dpi &&
398 selection_only == rhs.selection_only; 411 selection_only == rhs.selection_only;
399 } 412 }
400 413
401 // Checking if the current params is empty. Just initialized after a memset. 414 // Checking if the current params is empty. Just initialized after a memset.
402 bool IsEmpty() const { 415 bool IsEmpty() const {
403 return !document_cookie && !desired_dpi && !max_shrink && !min_shrink && 416 return !document_cookie && !desired_dpi && !max_shrink && !min_shrink &&
404 !dpi && printable_size.IsEmpty() && !selection_only; 417 !dpi && printable_size.IsEmpty() && !selection_only &&
418 page_size.IsEmpty() && !margin_top && !margin_left;
405 } 419 }
406 }; 420 };
407 421
408 struct ViewMsg_PrintPage_Params { 422 struct ViewMsg_PrintPage_Params {
409 // Parameters to render the page as a printed page. It must always be the same 423 // Parameters to render the page as a printed page. It must always be the same
410 // value for all the document. 424 // value for all the document.
411 ViewMsg_Print_Params params; 425 ViewMsg_Print_Params params;
412 426
413 // The page number is the indicator of the square that should be rendered 427 // The page number is the indicator of the square that should be rendered
414 // according to the layout specified in ViewMsg_Print_Params. 428 // according to the layout specified in ViewMsg_Print_Params.
(...skipping 19 matching lines...) Expand all
434 uint32 data_size; 448 uint32 data_size;
435 449
436 // Cookie for the document to ensure correctness. 450 // Cookie for the document to ensure correctness.
437 int document_cookie; 451 int document_cookie;
438 452
439 // Page number. 453 // Page number.
440 int page_number; 454 int page_number;
441 455
442 // Shrink factor used to render this page. 456 // Shrink factor used to render this page.
443 double actual_shrink; 457 double actual_shrink;
458
459 // The size of the page the page author specified.
460 gfx::Size page_size;
461
462 // The printable area the page author specified.
463 gfx::Rect content_area;
444 }; 464 };
445 465
446 // Parameters for creating an audio output stream. 466 // Parameters for creating an audio output stream.
447 struct ViewHostMsg_Audio_CreateStream_Params { 467 struct ViewHostMsg_Audio_CreateStream_Params {
448 // Format request for the stream. 468 // Format request for the stream.
449 AudioManager::Format format; 469 AudioManager::Format format;
450 470
451 // Number of channels. 471 // Number of channels.
452 int channels; 472 int channels;
453 473
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 static void Log(const param_type& p, std::wstring* l) { 1498 static void Log(const param_type& p, std::wstring* l) {
1479 l->append(L"<FormData>"); 1499 l->append(L"<FormData>");
1480 } 1500 }
1481 }; 1501 };
1482 1502
1483 // Traits for ViewMsg_Print_Params 1503 // Traits for ViewMsg_Print_Params
1484 template <> 1504 template <>
1485 struct ParamTraits<ViewMsg_Print_Params> { 1505 struct ParamTraits<ViewMsg_Print_Params> {
1486 typedef ViewMsg_Print_Params param_type; 1506 typedef ViewMsg_Print_Params param_type;
1487 static void Write(Message* m, const param_type& p) { 1507 static void Write(Message* m, const param_type& p) {
1508 WriteParam(m, p.page_size);
1488 WriteParam(m, p.printable_size); 1509 WriteParam(m, p.printable_size);
1510 WriteParam(m, p.margin_top);
1511 WriteParam(m, p.margin_left);
1489 WriteParam(m, p.dpi); 1512 WriteParam(m, p.dpi);
1490 WriteParam(m, p.min_shrink); 1513 WriteParam(m, p.min_shrink);
1491 WriteParam(m, p.max_shrink); 1514 WriteParam(m, p.max_shrink);
1492 WriteParam(m, p.desired_dpi); 1515 WriteParam(m, p.desired_dpi);
1493 WriteParam(m, p.document_cookie); 1516 WriteParam(m, p.document_cookie);
1494 WriteParam(m, p.selection_only); 1517 WriteParam(m, p.selection_only);
1495 } 1518 }
1496 static bool Read(const Message* m, void** iter, param_type* p) { 1519 static bool Read(const Message* m, void** iter, param_type* p) {
1497 return ReadParam(m, iter, &p->printable_size) && 1520 return ReadParam(m, iter, &p->page_size) &&
1521 ReadParam(m, iter, &p->printable_size) &&
1522 ReadParam(m, iter, &p->margin_top) &&
1523 ReadParam(m, iter, &p->margin_left) &&
1498 ReadParam(m, iter, &p->dpi) && 1524 ReadParam(m, iter, &p->dpi) &&
1499 ReadParam(m, iter, &p->min_shrink) && 1525 ReadParam(m, iter, &p->min_shrink) &&
1500 ReadParam(m, iter, &p->max_shrink) && 1526 ReadParam(m, iter, &p->max_shrink) &&
1501 ReadParam(m, iter, &p->desired_dpi) && 1527 ReadParam(m, iter, &p->desired_dpi) &&
1502 ReadParam(m, iter, &p->document_cookie) && 1528 ReadParam(m, iter, &p->document_cookie) &&
1503 ReadParam(m, iter, &p->selection_only); 1529 ReadParam(m, iter, &p->selection_only);
1504 } 1530 }
1505 static void Log(const param_type& p, std::wstring* l) { 1531 static void Log(const param_type& p, std::wstring* l) {
1506 l->append(L"<ViewMsg_Print_Params>"); 1532 l->append(L"<ViewMsg_Print_Params>");
1507 } 1533 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 // Traits for ViewHostMsg_DidPrintPage_Params 1570 // Traits for ViewHostMsg_DidPrintPage_Params
1545 template <> 1571 template <>
1546 struct ParamTraits<ViewHostMsg_DidPrintPage_Params> { 1572 struct ParamTraits<ViewHostMsg_DidPrintPage_Params> {
1547 typedef ViewHostMsg_DidPrintPage_Params param_type; 1573 typedef ViewHostMsg_DidPrintPage_Params param_type;
1548 static void Write(Message* m, const param_type& p) { 1574 static void Write(Message* m, const param_type& p) {
1549 WriteParam(m, p.metafile_data_handle); 1575 WriteParam(m, p.metafile_data_handle);
1550 WriteParam(m, p.data_size); 1576 WriteParam(m, p.data_size);
1551 WriteParam(m, p.document_cookie); 1577 WriteParam(m, p.document_cookie);
1552 WriteParam(m, p.page_number); 1578 WriteParam(m, p.page_number);
1553 WriteParam(m, p.actual_shrink); 1579 WriteParam(m, p.actual_shrink);
1580 WriteParam(m, p.page_size);
1581 WriteParam(m, p.content_area);
1554 } 1582 }
1555 static bool Read(const Message* m, void** iter, param_type* p) { 1583 static bool Read(const Message* m, void** iter, param_type* p) {
1556 return ReadParam(m, iter, &p->metafile_data_handle) && 1584 return ReadParam(m, iter, &p->metafile_data_handle) &&
1557 ReadParam(m, iter, &p->data_size) && 1585 ReadParam(m, iter, &p->data_size) &&
1558 ReadParam(m, iter, &p->document_cookie) && 1586 ReadParam(m, iter, &p->document_cookie) &&
1559 ReadParam(m, iter, &p->page_number) && 1587 ReadParam(m, iter, &p->page_number) &&
1560 ReadParam(m, iter, &p->actual_shrink); 1588 ReadParam(m, iter, &p->actual_shrink) &&
1589 ReadParam(m, iter, &p->page_size) &&
1590 ReadParam(m, iter, &p->content_area);
1561 } 1591 }
1562 static void Log(const param_type& p, std::wstring* l) { 1592 static void Log(const param_type& p, std::wstring* l) {
1563 l->append(L"<ViewHostMsg_DidPrintPage_Params>"); 1593 l->append(L"<ViewHostMsg_DidPrintPage_Params>");
1564 } 1594 }
1565 }; 1595 };
1566 1596
1567 // Traits for reading/writing CSS Colors 1597 // Traits for reading/writing CSS Colors
1568 template <> 1598 template <>
1569 struct ParamTraits<CSSColors::CSSColorName> { 1599 struct ParamTraits<CSSColors::CSSColorName> {
1570 typedef CSSColors::CSSColorName param_type; 1600 typedef CSSColors::CSSColorName param_type;
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 l->append(L")"); 2823 l->append(L")");
2794 } 2824 }
2795 }; 2825 };
2796 2826
2797 } // namespace IPC 2827 } // namespace IPC
2798 2828
2799 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" 2829 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
2800 #include "ipc/ipc_message_macros.h" 2830 #include "ipc/ipc_message_macros.h"
2801 2831
2802 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ 2832 #endif // CHROME_COMMON_RENDER_MESSAGES_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698