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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 const param_type& p, std::string* l) { | 420 const param_type& p, std::string* l) { |
421 l->append("("); | 421 l->append("("); |
422 if (p) { | 422 if (p) { |
423 LogParam(p->request_headers, l); | 423 LogParam(p->request_headers, l); |
424 l->append(", "); | 424 l->append(", "); |
425 LogParam(p->response_headers, l); | 425 LogParam(p->response_headers, l); |
426 } | 426 } |
427 l->append(")"); | 427 l->append(")"); |
428 } | 428 } |
429 | 429 |
| 430 void ParamTraits<base::PlatformFileInfo>::Write( |
| 431 Message* m, const param_type& p) { |
| 432 WriteParam(m, p.size); |
| 433 WriteParam(m, p.is_directory); |
| 434 WriteParam(m, p.last_modified.ToDoubleT()); |
| 435 WriteParam(m, p.last_accessed.ToDoubleT()); |
| 436 WriteParam(m, p.creation_time.ToDoubleT()); |
| 437 } |
| 438 |
| 439 bool ParamTraits<base::PlatformFileInfo>::Read( |
| 440 const Message* m, void** iter, param_type* p) { |
| 441 double last_modified; |
| 442 double last_accessed; |
| 443 double creation_time; |
| 444 bool result = |
| 445 ReadParam(m, iter, &p->size) && |
| 446 ReadParam(m, iter, &p->is_directory) && |
| 447 ReadParam(m, iter, &last_modified) && |
| 448 ReadParam(m, iter, &last_accessed) && |
| 449 ReadParam(m, iter, &creation_time); |
| 450 if (result) { |
| 451 p->last_modified = base::Time::FromDoubleT(last_modified); |
| 452 p->last_accessed = base::Time::FromDoubleT(last_accessed); |
| 453 p->creation_time = base::Time::FromDoubleT(creation_time); |
| 454 } |
| 455 return result; |
| 456 } |
| 457 |
| 458 void ParamTraits<base::PlatformFileInfo>::Log( |
| 459 const param_type& p, std::string* l) { |
| 460 l->append("("); |
| 461 LogParam(p.size, l); |
| 462 l->append(","); |
| 463 LogParam(p.is_directory, l); |
| 464 l->append(","); |
| 465 LogParam(p.last_modified.ToDoubleT(), l); |
| 466 l->append(","); |
| 467 LogParam(p.last_accessed.ToDoubleT(), l); |
| 468 l->append(","); |
| 469 LogParam(p.creation_time.ToDoubleT(), l); |
| 470 l->append(")"); |
| 471 } |
| 472 |
430 } // namespace IPC | 473 } // namespace IPC |
OLD | NEW |