| 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 "chrome/common/common_param_traits.h" | 5 #include "chrome/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
| 10 #include "chrome/common/geoposition.h" | 10 #include "chrome/common/geoposition.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 std::vector<uint8> buffer; | 437 std::vector<uint8> buffer; |
| 438 return ReadParam(m, iter, &buffer) && | 438 return ReadParam(m, iter, &buffer) && |
| 439 p->Init(&buffer.front(), static_cast<uint32>(buffer.size())); | 439 p->Init(&buffer.front(), static_cast<uint32>(buffer.size())); |
| 440 } | 440 } |
| 441 | 441 |
| 442 void ParamTraits<printing::NativeMetafile>::Log( | 442 void ParamTraits<printing::NativeMetafile>::Log( |
| 443 const param_type& p, std::string* l) { | 443 const param_type& p, std::string* l) { |
| 444 l->append("<printing::NativeMetafile>"); | 444 l->append("<printing::NativeMetafile>"); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void ParamTraits<base::PlatformFileInfo>::Write( | |
| 448 Message* m, const param_type& p) { | |
| 449 WriteParam(m, p.size); | |
| 450 WriteParam(m, p.is_directory); | |
| 451 WriteParam(m, p.last_modified.ToDoubleT()); | |
| 452 WriteParam(m, p.last_accessed.ToDoubleT()); | |
| 453 WriteParam(m, p.creation_time.ToDoubleT()); | |
| 454 } | |
| 455 | |
| 456 bool ParamTraits<base::PlatformFileInfo>::Read( | |
| 457 const Message* m, void** iter, param_type* p) { | |
| 458 double last_modified; | |
| 459 double last_accessed; | |
| 460 double creation_time; | |
| 461 bool result = | |
| 462 ReadParam(m, iter, &p->size) && | |
| 463 ReadParam(m, iter, &p->is_directory) && | |
| 464 ReadParam(m, iter, &last_modified) && | |
| 465 ReadParam(m, iter, &last_accessed) && | |
| 466 ReadParam(m, iter, &creation_time); | |
| 467 if (result) { | |
| 468 p->last_modified = base::Time::FromDoubleT(last_modified); | |
| 469 p->last_accessed = base::Time::FromDoubleT(last_accessed); | |
| 470 p->creation_time = base::Time::FromDoubleT(creation_time); | |
| 471 } | |
| 472 return result; | |
| 473 } | |
| 474 | |
| 475 void ParamTraits<base::PlatformFileInfo>::Log( | |
| 476 const param_type& p, std::string* l) { | |
| 477 l->append("("); | |
| 478 LogParam(p.size, l); | |
| 479 l->append(","); | |
| 480 LogParam(p.is_directory, l); | |
| 481 l->append(","); | |
| 482 LogParam(p.last_modified.ToDoubleT(), l); | |
| 483 l->append(","); | |
| 484 LogParam(p.last_accessed.ToDoubleT(), l); | |
| 485 l->append(","); | |
| 486 LogParam(p.creation_time.ToDoubleT(), l); | |
| 487 l->append(")"); | |
| 488 } | |
| 489 | |
| 490 void ParamTraits<printing::PrinterCapsAndDefaults>::Write( | 447 void ParamTraits<printing::PrinterCapsAndDefaults>::Write( |
| 491 Message* m, const param_type& p) { | 448 Message* m, const param_type& p) { |
| 492 WriteParam(m, p.printer_capabilities); | 449 WriteParam(m, p.printer_capabilities); |
| 493 WriteParam(m, p.caps_mime_type); | 450 WriteParam(m, p.caps_mime_type); |
| 494 WriteParam(m, p.printer_defaults); | 451 WriteParam(m, p.printer_defaults); |
| 495 WriteParam(m, p.defaults_mime_type); | 452 WriteParam(m, p.defaults_mime_type); |
| 496 } | 453 } |
| 497 | 454 |
| 498 bool ParamTraits<printing::PrinterCapsAndDefaults>::Read( | 455 bool ParamTraits<printing::PrinterCapsAndDefaults>::Read( |
| 499 const Message* m, void** iter, param_type* p) { | 456 const Message* m, void** iter, param_type* p) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 511 l->append(","); | 468 l->append(","); |
| 512 LogParam(p.caps_mime_type, l); | 469 LogParam(p.caps_mime_type, l); |
| 513 l->append(","); | 470 l->append(","); |
| 514 LogParam(p.printer_defaults, l); | 471 LogParam(p.printer_defaults, l); |
| 515 l->append(","); | 472 l->append(","); |
| 516 LogParam(p.defaults_mime_type, l); | 473 LogParam(p.defaults_mime_type, l); |
| 517 l->append(")"); | 474 l->append(")"); |
| 518 } | 475 } |
| 519 | 476 |
| 520 } // namespace IPC | 477 } // namespace IPC |
| OLD | NEW |