Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "content/common/common_param_traits.h" | 5 #include "content/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "content/common/content_constants.h" | 7 #include "content/common/content_constants.h" |
| 8 #include "net/base/host_port_pair.h" | 8 #include "net/base/host_port_pair.h" |
| 9 #include "net/base/upload_data.h" | 9 #include "net/base/upload_data.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "ui/gfx/point.h" | |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
|
jam
2011/04/15 19:01:21
rect.h is enough, since it brings in the other two
grt (UTC plus 2)
2011/04/15 19:39:54
Done.
| |
| 14 #include "webkit/glue/password_form.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "webkit/glue/resource_loader_bridge.h" | |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 struct SkBitmap_Data { | 18 struct SkBitmap_Data { |
| 20 // The configuration for the bitmap (bits per pixel, etc). | 19 // The configuration for the bitmap (bits per pixel, etc). |
| 21 SkBitmap::Config fConfig; | 20 SkBitmap::Config fConfig; |
| 22 | 21 |
| 23 // The width of the bitmap in pixels. | 22 // The width of the bitmap in pixels. |
| 24 uint32 fWidth; | 23 uint32 fWidth; |
| 25 | 24 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 42 if (total_pixels != bitmap->getSize()) | 41 if (total_pixels != bitmap->getSize()) |
| 43 return false; | 42 return false; |
| 44 memcpy(bitmap->getPixels(), pixels, total_pixels); | 43 memcpy(bitmap->getPixels(), pixels, total_pixels); |
| 45 } | 44 } |
| 46 return true; | 45 return true; |
| 47 } | 46 } |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace | 49 } // namespace |
| 51 | 50 |
| 52 NPIdentifier_Param::NPIdentifier_Param() | |
| 53 : identifier() { | |
| 54 } | |
| 55 | |
| 56 NPIdentifier_Param::~NPIdentifier_Param() { | |
| 57 } | |
| 58 | |
| 59 NPVariant_Param::NPVariant_Param() | |
| 60 : type(NPVARIANT_PARAM_VOID), | |
| 61 bool_value(false), | |
| 62 int_value(0), | |
| 63 double_value(0), | |
| 64 npobject_routing_id(-1) { | |
| 65 } | |
| 66 | |
| 67 NPVariant_Param::~NPVariant_Param() { | |
| 68 } | |
| 69 | |
| 70 namespace IPC { | 51 namespace IPC { |
| 71 | 52 |
| 72 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { | 53 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { |
| 73 m->WriteString(p.possibly_invalid_spec()); | 54 m->WriteString(p.possibly_invalid_spec()); |
| 74 // TODO(brettw) bug 684583: Add encoding for query params. | 55 // TODO(brettw) bug 684583: Add encoding for query params. |
| 75 } | 56 } |
| 76 | 57 |
| 77 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { | 58 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { |
| 78 std::string s; | 59 std::string s; |
| 79 if (!m->ReadString(iter, &s) || s.length() > content::kMaxURLChars) { | 60 if (!m->ReadString(iter, &s) || s.length() > content::kMaxURLChars) { |
| 80 *p = GURL(); | 61 *p = GURL(); |
| 81 return false; | 62 return false; |
| 82 } | 63 } |
| 83 *p = GURL(s); | 64 *p = GURL(s); |
| 84 return true; | 65 return true; |
| 85 } | 66 } |
| 86 | 67 |
| 87 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { | 68 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { |
| 88 l->append(p.spec()); | 69 l->append(p.spec()); |
| 89 } | 70 } |
| 90 | 71 |
| 91 | |
| 92 void ParamTraits<ResourceType::Type>::Write(Message* m, const param_type& p) { | 72 void ParamTraits<ResourceType::Type>::Write(Message* m, const param_type& p) { |
| 93 m->WriteInt(p); | 73 m->WriteInt(p); |
| 94 } | 74 } |
| 95 | 75 |
| 96 bool ParamTraits<ResourceType::Type>::Read(const Message* m, | 76 bool ParamTraits<ResourceType::Type>::Read(const Message* m, |
| 97 void** iter, | 77 void** iter, |
| 98 param_type* p) { | 78 param_type* p) { |
| 99 int type; | 79 int type; |
| 100 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) | 80 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) |
| 101 return false; | 81 return false; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) | 388 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) |
| 409 return false; | 389 return false; |
| 410 *p = net::IPEndPoint(address, port); | 390 *p = net::IPEndPoint(address, port); |
| 411 return true; | 391 return true; |
| 412 } | 392 } |
| 413 | 393 |
| 414 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { | 394 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { |
| 415 LogParam("IPEndPoint:" + p.ToString(), l); | 395 LogParam("IPEndPoint:" + p.ToString(), l); |
| 416 } | 396 } |
| 417 | 397 |
| 418 void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Write( | |
| 419 Message* m, const param_type& p) { | |
| 420 WriteParam(m, p.base_time.is_null()); | |
| 421 if (p.base_time.is_null()) | |
| 422 return; | |
| 423 WriteParam(m, p.base_time); | |
| 424 WriteParam(m, p.proxy_start); | |
| 425 WriteParam(m, p.proxy_end); | |
| 426 WriteParam(m, p.dns_start); | |
| 427 WriteParam(m, p.dns_end); | |
| 428 WriteParam(m, p.connect_start); | |
| 429 WriteParam(m, p.connect_end); | |
| 430 WriteParam(m, p.ssl_start); | |
| 431 WriteParam(m, p.ssl_end); | |
| 432 WriteParam(m, p.send_start); | |
| 433 WriteParam(m, p.send_end); | |
| 434 WriteParam(m, p.receive_headers_start); | |
| 435 WriteParam(m, p.receive_headers_end); | |
| 436 } | |
| 437 | |
| 438 bool ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Read( | |
| 439 const Message* m, void** iter, param_type* r) { | |
| 440 bool is_null; | |
| 441 if (!ReadParam(m, iter, &is_null)) | |
| 442 return false; | |
| 443 if (is_null) | |
| 444 return true; | |
| 445 | |
| 446 return | |
| 447 ReadParam(m, iter, &r->base_time) && | |
| 448 ReadParam(m, iter, &r->proxy_start) && | |
| 449 ReadParam(m, iter, &r->proxy_end) && | |
| 450 ReadParam(m, iter, &r->dns_start) && | |
| 451 ReadParam(m, iter, &r->dns_end) && | |
| 452 ReadParam(m, iter, &r->connect_start) && | |
| 453 ReadParam(m, iter, &r->connect_end) && | |
| 454 ReadParam(m, iter, &r->ssl_start) && | |
| 455 ReadParam(m, iter, &r->ssl_end) && | |
| 456 ReadParam(m, iter, &r->send_start) && | |
| 457 ReadParam(m, iter, &r->send_end) && | |
| 458 ReadParam(m, iter, &r->receive_headers_start) && | |
| 459 ReadParam(m, iter, &r->receive_headers_end); | |
| 460 } | |
| 461 | |
| 462 void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Log(const param_type& p, | |
| 463 std::string* l) { | |
| 464 l->append("("); | |
| 465 LogParam(p.base_time, l); | |
| 466 l->append(", "); | |
| 467 LogParam(p.proxy_start, l); | |
| 468 l->append(", "); | |
| 469 LogParam(p.proxy_end, l); | |
| 470 l->append(", "); | |
| 471 LogParam(p.dns_start, l); | |
| 472 l->append(", "); | |
| 473 LogParam(p.dns_end, l); | |
| 474 l->append(", "); | |
| 475 LogParam(p.connect_start, l); | |
| 476 l->append(", "); | |
| 477 LogParam(p.connect_end, l); | |
| 478 l->append(", "); | |
| 479 LogParam(p.ssl_start, l); | |
| 480 l->append(", "); | |
| 481 LogParam(p.ssl_end, l); | |
| 482 l->append(", "); | |
| 483 LogParam(p.send_start, l); | |
| 484 l->append(", "); | |
| 485 LogParam(p.send_end, l); | |
| 486 l->append(", "); | |
| 487 LogParam(p.receive_headers_start, l); | |
| 488 l->append(", "); | |
| 489 LogParam(p.receive_headers_end, l); | |
| 490 l->append(")"); | |
| 491 } | |
| 492 | |
| 493 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Write( | |
| 494 Message* m, const param_type& p) { | |
| 495 WriteParam(m, p.get() != NULL); | |
| 496 if (p.get()) { | |
| 497 WriteParam(m, p->http_status_code); | |
| 498 WriteParam(m, p->http_status_text); | |
| 499 WriteParam(m, p->request_headers); | |
| 500 WriteParam(m, p->response_headers); | |
| 501 } | |
| 502 } | |
| 503 | |
| 504 bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( | |
| 505 const Message* m, void** iter, param_type* r) { | |
| 506 bool has_object; | |
| 507 if (!ReadParam(m, iter, &has_object)) | |
| 508 return false; | |
| 509 if (!has_object) | |
| 510 return true; | |
| 511 *r = new webkit_glue::ResourceDevToolsInfo(); | |
| 512 return | |
| 513 ReadParam(m, iter, &(*r)->http_status_code) && | |
| 514 ReadParam(m, iter, &(*r)->http_status_text) && | |
| 515 ReadParam(m, iter, &(*r)->request_headers) && | |
| 516 ReadParam(m, iter, &(*r)->response_headers); | |
| 517 } | |
| 518 | |
| 519 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log( | |
| 520 const param_type& p, std::string* l) { | |
| 521 l->append("("); | |
| 522 if (p) { | |
| 523 LogParam(p->request_headers, l); | |
| 524 l->append(", "); | |
| 525 LogParam(p->response_headers, l); | |
| 526 } | |
| 527 l->append(")"); | |
| 528 } | |
| 529 | |
| 530 void ParamTraits<base::PlatformFileInfo>::Write( | 398 void ParamTraits<base::PlatformFileInfo>::Write( |
| 531 Message* m, const param_type& p) { | 399 Message* m, const param_type& p) { |
| 532 WriteParam(m, p.size); | 400 WriteParam(m, p.size); |
| 533 WriteParam(m, p.is_directory); | 401 WriteParam(m, p.is_directory); |
| 534 WriteParam(m, p.last_modified.ToDoubleT()); | 402 WriteParam(m, p.last_modified.ToDoubleT()); |
| 535 WriteParam(m, p.last_accessed.ToDoubleT()); | 403 WriteParam(m, p.last_accessed.ToDoubleT()); |
| 536 WriteParam(m, p.creation_time.ToDoubleT()); | 404 WriteParam(m, p.creation_time.ToDoubleT()); |
| 537 } | 405 } |
| 538 | 406 |
| 539 bool ParamTraits<base::PlatformFileInfo>::Read( | 407 bool ParamTraits<base::PlatformFileInfo>::Read( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 r->set_width(w); | 496 r->set_width(w); |
| 629 r->set_height(h); | 497 r->set_height(h); |
| 630 return true; | 498 return true; |
| 631 } | 499 } |
| 632 | 500 |
| 633 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { | 501 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { |
| 634 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), | 502 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), |
| 635 p.width(), p.height())); | 503 p.width(), p.height())); |
| 636 } | 504 } |
| 637 | 505 |
| 638 // Only the webkit_blob::BlobData ParamTraits<> definition needs this | |
| 639 // definition, so keep this in the implementation file so we can forward declare | |
| 640 // BlobData in the header. | |
| 641 template <> | |
| 642 struct ParamTraits<webkit_blob::BlobData::Item> { | |
| 643 typedef webkit_blob::BlobData::Item param_type; | |
| 644 static void Write(Message* m, const param_type& p) { | |
| 645 WriteParam(m, static_cast<int>(p.type())); | |
| 646 if (p.type() == webkit_blob::BlobData::TYPE_DATA) { | |
| 647 WriteParam(m, p.data()); | |
| 648 } else if (p.type() == webkit_blob::BlobData::TYPE_FILE) { | |
| 649 WriteParam(m, p.file_path()); | |
| 650 WriteParam(m, p.offset()); | |
| 651 WriteParam(m, p.length()); | |
| 652 WriteParam(m, p.expected_modification_time()); | |
| 653 } else { | |
| 654 WriteParam(m, p.blob_url()); | |
| 655 WriteParam(m, p.offset()); | |
| 656 WriteParam(m, p.length()); | |
| 657 } | |
| 658 } | |
| 659 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 660 int type; | |
| 661 if (!ReadParam(m, iter, &type)) | |
| 662 return false; | |
| 663 if (type == webkit_blob::BlobData::TYPE_DATA) { | |
| 664 std::string data; | |
| 665 if (!ReadParam(m, iter, &data)) | |
| 666 return false; | |
| 667 r->SetToData(data); | |
| 668 } else if (type == webkit_blob::BlobData::TYPE_FILE) { | |
| 669 FilePath file_path; | |
| 670 uint64 offset, length; | |
| 671 base::Time expected_modification_time; | |
| 672 if (!ReadParam(m, iter, &file_path)) | |
| 673 return false; | |
| 674 if (!ReadParam(m, iter, &offset)) | |
| 675 return false; | |
| 676 if (!ReadParam(m, iter, &length)) | |
| 677 return false; | |
| 678 if (!ReadParam(m, iter, &expected_modification_time)) | |
| 679 return false; | |
| 680 r->SetToFile(file_path, offset, length, expected_modification_time); | |
| 681 } else { | |
| 682 DCHECK(type == webkit_blob::BlobData::TYPE_BLOB); | |
| 683 GURL blob_url; | |
| 684 uint64 offset, length; | |
| 685 if (!ReadParam(m, iter, &blob_url)) | |
| 686 return false; | |
| 687 if (!ReadParam(m, iter, &offset)) | |
| 688 return false; | |
| 689 if (!ReadParam(m, iter, &length)) | |
| 690 return false; | |
| 691 r->SetToBlob(blob_url, offset, length); | |
| 692 } | |
| 693 return true; | |
| 694 } | |
| 695 static void Log(const param_type& p, std::string* l) { | |
| 696 l->append("<BlobData::Item>"); | |
| 697 } | |
| 698 }; | |
| 699 | |
| 700 void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Write( | |
| 701 Message* m, const param_type& p) { | |
| 702 WriteParam(m, p.get() != NULL); | |
| 703 if (p) { | |
| 704 WriteParam(m, p->items()); | |
| 705 WriteParam(m, p->content_type()); | |
| 706 WriteParam(m, p->content_disposition()); | |
| 707 } | |
| 708 } | |
| 709 | |
| 710 bool ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Read( | |
| 711 const Message* m, void** iter, param_type* r) { | |
| 712 bool has_object; | |
| 713 if (!ReadParam(m, iter, &has_object)) | |
| 714 return false; | |
| 715 if (!has_object) | |
| 716 return true; | |
| 717 std::vector<webkit_blob::BlobData::Item> items; | |
| 718 if (!ReadParam(m, iter, &items)) | |
| 719 return false; | |
| 720 std::string content_type; | |
| 721 if (!ReadParam(m, iter, &content_type)) | |
| 722 return false; | |
| 723 std::string content_disposition; | |
| 724 if (!ReadParam(m, iter, &content_disposition)) | |
| 725 return false; | |
| 726 *r = new webkit_blob::BlobData; | |
| 727 (*r)->swap_items(&items); | |
| 728 (*r)->set_content_type(content_type); | |
| 729 (*r)->set_content_disposition(content_disposition); | |
| 730 return true; | |
| 731 } | |
| 732 | |
| 733 void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Log( | |
| 734 const param_type& p, std::string* l) { | |
| 735 l->append("<webkit_blob::BlobData>"); | |
| 736 } | |
| 737 | |
| 738 void ParamTraits<NPVariant_Param>::Write(Message* m, const param_type& p) { | |
| 739 WriteParam(m, static_cast<int>(p.type)); | |
| 740 if (p.type == NPVARIANT_PARAM_BOOL) { | |
| 741 WriteParam(m, p.bool_value); | |
| 742 } else if (p.type == NPVARIANT_PARAM_INT) { | |
| 743 WriteParam(m, p.int_value); | |
| 744 } else if (p.type == NPVARIANT_PARAM_DOUBLE) { | |
| 745 WriteParam(m, p.double_value); | |
| 746 } else if (p.type == NPVARIANT_PARAM_STRING) { | |
| 747 WriteParam(m, p.string_value); | |
| 748 } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || | |
| 749 p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { | |
| 750 // This is the routing id used to connect NPObjectProxy in the other | |
| 751 // process with NPObjectStub in this process or to identify the raw | |
| 752 // npobject pointer to be used in the callee process. | |
| 753 WriteParam(m, p.npobject_routing_id); | |
| 754 } else { | |
| 755 DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL); | |
| 756 } | |
| 757 } | |
| 758 | |
| 759 bool ParamTraits<NPVariant_Param>::Read(const Message* m, | |
| 760 void** iter, | |
| 761 param_type* r) { | |
| 762 int type; | |
| 763 if (!ReadParam(m, iter, &type)) | |
| 764 return false; | |
| 765 | |
| 766 bool result = false; | |
| 767 r->type = static_cast<NPVariant_ParamEnum>(type); | |
| 768 if (r->type == NPVARIANT_PARAM_BOOL) { | |
| 769 result = ReadParam(m, iter, &r->bool_value); | |
| 770 } else if (r->type == NPVARIANT_PARAM_INT) { | |
| 771 result = ReadParam(m, iter, &r->int_value); | |
| 772 } else if (r->type == NPVARIANT_PARAM_DOUBLE) { | |
| 773 result = ReadParam(m, iter, &r->double_value); | |
| 774 } else if (r->type == NPVARIANT_PARAM_STRING) { | |
| 775 result = ReadParam(m, iter, &r->string_value); | |
| 776 } else if (r->type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || | |
| 777 r->type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { | |
| 778 result = ReadParam(m, iter, &r->npobject_routing_id); | |
| 779 } else if ((r->type == NPVARIANT_PARAM_VOID) || | |
| 780 (r->type == NPVARIANT_PARAM_NULL)) { | |
| 781 result = true; | |
| 782 } else { | |
| 783 NOTREACHED(); | |
| 784 } | |
| 785 | |
| 786 return result; | |
| 787 } | |
| 788 | |
| 789 void ParamTraits<NPVariant_Param>::Log(const param_type& p, std::string* l) { | |
| 790 if (p.type == NPVARIANT_PARAM_BOOL) { | |
| 791 LogParam(p.bool_value, l); | |
| 792 } else if (p.type == NPVARIANT_PARAM_INT) { | |
| 793 LogParam(p.int_value, l); | |
| 794 } else if (p.type == NPVARIANT_PARAM_DOUBLE) { | |
| 795 LogParam(p.double_value, l); | |
| 796 } else if (p.type == NPVARIANT_PARAM_STRING) { | |
| 797 LogParam(p.string_value, l); | |
| 798 } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || | |
| 799 p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { | |
| 800 LogParam(p.npobject_routing_id, l); | |
| 801 } | |
| 802 } | |
| 803 | |
| 804 void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) { | |
| 805 webkit_glue::SerializeNPIdentifier(p.identifier, m); | |
| 806 } | |
| 807 | |
| 808 bool ParamTraits<NPIdentifier_Param>::Read(const Message* m, | |
| 809 void** iter, | |
| 810 param_type* r) { | |
| 811 return webkit_glue::DeserializeNPIdentifier(*m, iter, &r->identifier); | |
| 812 } | |
| 813 | |
| 814 void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { | |
| 815 if (WebKit::WebBindings::identifierIsString(p.identifier)) { | |
| 816 NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); | |
| 817 l->append(str); | |
| 818 NPN_MemFree(str); | |
| 819 } else { | |
| 820 l->append(base::IntToString( | |
| 821 WebKit::WebBindings::intFromIdentifier(p.identifier))); | |
| 822 } | |
| 823 } | |
| 824 | |
| 825 void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) { | 506 void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) { |
| 826 size_t fixed_size = sizeof(SkBitmap_Data); | 507 size_t fixed_size = sizeof(SkBitmap_Data); |
| 827 SkBitmap_Data bmp_data; | 508 SkBitmap_Data bmp_data; |
| 828 bmp_data.InitSkBitmapDataForTransfer(p); | 509 bmp_data.InitSkBitmapDataForTransfer(p); |
| 829 m->WriteData(reinterpret_cast<const char*>(&bmp_data), | 510 m->WriteData(reinterpret_cast<const char*>(&bmp_data), |
| 830 static_cast<int>(fixed_size)); | 511 static_cast<int>(fixed_size)); |
| 831 size_t pixel_size = p.getSize(); | 512 size_t pixel_size = p.getSize(); |
| 832 SkAutoLockPixels p_lock(p); | 513 SkAutoLockPixels p_lock(p); |
| 833 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), | 514 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), |
| 834 static_cast<int>(pixel_size)); | 515 static_cast<int>(pixel_size)); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 854 } | 535 } |
| 855 const SkBitmap_Data* bmp_data = | 536 const SkBitmap_Data* bmp_data = |
| 856 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 537 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
| 857 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 538 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
| 858 } | 539 } |
| 859 | 540 |
| 860 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 541 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
| 861 l->append("<SkBitmap>"); | 542 l->append("<SkBitmap>"); |
| 862 } | 543 } |
| 863 | 544 |
| 864 void ParamTraits<webkit_glue::PasswordForm>::Write(Message* m, | |
| 865 const param_type& p) { | |
| 866 WriteParam(m, p.signon_realm); | |
| 867 WriteParam(m, p.origin); | |
| 868 WriteParam(m, p.action); | |
| 869 WriteParam(m, p.submit_element); | |
| 870 WriteParam(m, p.username_element); | |
| 871 WriteParam(m, p.username_value); | |
| 872 WriteParam(m, p.password_element); | |
| 873 WriteParam(m, p.password_value); | |
| 874 WriteParam(m, p.old_password_element); | |
| 875 WriteParam(m, p.old_password_value); | |
| 876 WriteParam(m, p.ssl_valid); | |
| 877 WriteParam(m, p.preferred); | |
| 878 WriteParam(m, p.blacklisted_by_user); | |
| 879 } | |
| 880 | |
| 881 bool ParamTraits<webkit_glue::PasswordForm>::Read(const Message* m, void** iter, | |
| 882 param_type* p) { | |
| 883 return | |
| 884 ReadParam(m, iter, &p->signon_realm) && | |
| 885 ReadParam(m, iter, &p->origin) && | |
| 886 ReadParam(m, iter, &p->action) && | |
| 887 ReadParam(m, iter, &p->submit_element) && | |
| 888 ReadParam(m, iter, &p->username_element) && | |
| 889 ReadParam(m, iter, &p->username_value) && | |
| 890 ReadParam(m, iter, &p->password_element) && | |
| 891 ReadParam(m, iter, &p->password_value) && | |
| 892 ReadParam(m, iter, &p->old_password_element) && | |
| 893 ReadParam(m, iter, &p->old_password_value) && | |
| 894 ReadParam(m, iter, &p->ssl_valid) && | |
| 895 ReadParam(m, iter, &p->preferred) && | |
| 896 ReadParam(m, iter, &p->blacklisted_by_user); | |
| 897 } | |
| 898 void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p, | |
| 899 std::string* l) { | |
| 900 l->append("<PasswordForm>"); | |
| 901 } | |
| 902 | |
| 903 } // namespace IPC | 545 } // namespace IPC |
| OLD | NEW |