| 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" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 l->append(")"); | 466 l->append(")"); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void ParamTraits<base::PlatformFileInfo>::Write( | 469 void ParamTraits<base::PlatformFileInfo>::Write( |
| 470 Message* m, const param_type& p) { | 470 Message* m, const param_type& p) { |
| 471 WriteParam(m, p.size); | 471 WriteParam(m, p.size); |
| 472 WriteParam(m, p.is_directory); | 472 WriteParam(m, p.is_directory); |
| 473 WriteParam(m, p.last_modified.ToDoubleT()); | 473 WriteParam(m, p.last_modified.ToDoubleT()); |
| 474 WriteParam(m, p.last_accessed.ToDoubleT()); | 474 WriteParam(m, p.last_accessed.ToDoubleT()); |
| 475 WriteParam(m, p.creation_time.ToDoubleT()); | 475 WriteParam(m, p.creation_time.ToDoubleT()); |
| 476 WriteParam(m, p.path); |
| 476 } | 477 } |
| 477 | 478 |
| 478 bool ParamTraits<base::PlatformFileInfo>::Read( | 479 bool ParamTraits<base::PlatformFileInfo>::Read( |
| 479 const Message* m, void** iter, param_type* p) { | 480 const Message* m, void** iter, param_type* p) { |
| 480 double last_modified; | 481 double last_modified; |
| 481 double last_accessed; | 482 double last_accessed; |
| 482 double creation_time; | 483 double creation_time; |
| 483 bool result = | 484 bool result = |
| 484 ReadParam(m, iter, &p->size) && | 485 ReadParam(m, iter, &p->size) && |
| 485 ReadParam(m, iter, &p->is_directory) && | 486 ReadParam(m, iter, &p->is_directory) && |
| 486 ReadParam(m, iter, &last_modified) && | 487 ReadParam(m, iter, &last_modified) && |
| 487 ReadParam(m, iter, &last_accessed) && | 488 ReadParam(m, iter, &last_accessed) && |
| 488 ReadParam(m, iter, &creation_time); | 489 ReadParam(m, iter, &creation_time) && |
| 490 ReadParam(m, iter, &p->path); |
| 489 if (result) { | 491 if (result) { |
| 490 p->last_modified = base::Time::FromDoubleT(last_modified); | 492 p->last_modified = base::Time::FromDoubleT(last_modified); |
| 491 p->last_accessed = base::Time::FromDoubleT(last_accessed); | 493 p->last_accessed = base::Time::FromDoubleT(last_accessed); |
| 492 p->creation_time = base::Time::FromDoubleT(creation_time); | 494 p->creation_time = base::Time::FromDoubleT(creation_time); |
| 493 } | 495 } |
| 494 return result; | 496 return result; |
| 495 } | 497 } |
| 496 | 498 |
| 497 void ParamTraits<base::PlatformFileInfo>::Log( | 499 void ParamTraits<base::PlatformFileInfo>::Log( |
| 498 const param_type& p, std::string* l) { | 500 const param_type& p, std::string* l) { |
| 499 l->append("("); | 501 l->append("("); |
| 500 LogParam(p.size, l); | 502 LogParam(p.size, l); |
| 501 l->append(","); | 503 l->append(","); |
| 502 LogParam(p.is_directory, l); | 504 LogParam(p.is_directory, l); |
| 503 l->append(","); | 505 l->append(","); |
| 504 LogParam(p.last_modified.ToDoubleT(), l); | 506 LogParam(p.last_modified.ToDoubleT(), l); |
| 505 l->append(","); | 507 l->append(","); |
| 506 LogParam(p.last_accessed.ToDoubleT(), l); | 508 LogParam(p.last_accessed.ToDoubleT(), l); |
| 507 l->append(","); | 509 l->append(","); |
| 508 LogParam(p.creation_time.ToDoubleT(), l); | 510 LogParam(p.creation_time.ToDoubleT(), l); |
| 511 l->append(","); |
| 512 LogParam(p.path, l); |
| 509 l->append(")"); | 513 l->append(")"); |
| 510 } | 514 } |
| 511 | 515 |
| 512 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { | 516 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { |
| 513 m->WriteInt(p.x()); | 517 m->WriteInt(p.x()); |
| 514 m->WriteInt(p.y()); | 518 m->WriteInt(p.y()); |
| 515 } | 519 } |
| 516 | 520 |
| 517 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, | 521 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, |
| 518 gfx::Point* r) { | 522 gfx::Point* r) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); | 759 NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); |
| 756 l->append(str); | 760 l->append(str); |
| 757 NPN_MemFree(str); | 761 NPN_MemFree(str); |
| 758 } else { | 762 } else { |
| 759 l->append(base::IntToString( | 763 l->append(base::IntToString( |
| 760 WebKit::WebBindings::intFromIdentifier(p.identifier))); | 764 WebKit::WebBindings::intFromIdentifier(p.identifier))); |
| 761 } | 765 } |
| 762 } | 766 } |
| 763 | 767 |
| 764 } // namespace IPC | 768 } // namespace IPC |
| OLD | NEW |