OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/nullable_string16.h" | 10 #include "base/strings/nullable_string16.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 WriteParam(m, p.size); | 560 WriteParam(m, p.size); |
561 WriteParam(m, p.is_directory); | 561 WriteParam(m, p.is_directory); |
562 WriteParam(m, p.last_modified.ToDoubleT()); | 562 WriteParam(m, p.last_modified.ToDoubleT()); |
563 WriteParam(m, p.last_accessed.ToDoubleT()); | 563 WriteParam(m, p.last_accessed.ToDoubleT()); |
564 WriteParam(m, p.creation_time.ToDoubleT()); | 564 WriteParam(m, p.creation_time.ToDoubleT()); |
565 } | 565 } |
566 | 566 |
567 bool ParamTraits<base::File::Info>::Read(const Message* m, | 567 bool ParamTraits<base::File::Info>::Read(const Message* m, |
568 PickleIterator* iter, | 568 PickleIterator* iter, |
569 param_type* p) { | 569 param_type* p) { |
570 double last_modified; | 570 double last_modified, last_accessed, creation_time; |
571 double last_accessed; | 571 if (!ReadParam(m, iter, &p->size) || |
572 double creation_time; | 572 !ReadParam(m, iter, &p->is_directory) || |
573 bool result = | 573 !ReadParam(m, iter, &last_modified) || |
574 ReadParam(m, iter, &p->size) && | 574 !ReadParam(m, iter, &last_accessed) || |
575 ReadParam(m, iter, &p->is_directory) && | 575 !ReadParam(m, iter, &creation_time)) |
576 ReadParam(m, iter, &last_modified) && | 576 return false; |
577 ReadParam(m, iter, &last_accessed) && | 577 p->last_modified = base::Time::FromDoubleT(last_modified); |
578 ReadParam(m, iter, &creation_time); | 578 p->last_accessed = base::Time::FromDoubleT(last_accessed); |
579 if (result) { | 579 p->creation_time = base::Time::FromDoubleT(creation_time); |
580 p->last_modified = base::Time::FromDoubleT(last_modified); | 580 return true; |
581 p->last_accessed = base::Time::FromDoubleT(last_accessed); | |
582 p->creation_time = base::Time::FromDoubleT(creation_time); | |
583 } | |
584 return result; | |
585 } | 581 } |
586 | 582 |
587 void ParamTraits<base::File::Info>::Log(const param_type& p, | 583 void ParamTraits<base::File::Info>::Log(const param_type& p, |
588 std::string* l) { | 584 std::string* l) { |
589 l->append("("); | 585 l->append("("); |
590 LogParam(p.size, l); | 586 LogParam(p.size, l); |
591 l->append(","); | 587 l->append(","); |
592 LogParam(p.is_directory, l); | 588 LogParam(p.is_directory, l); |
593 l->append(","); | 589 l->append(","); |
594 LogParam(p.last_modified.ToDoubleT(), l); | 590 LogParam(p.last_modified.ToDoubleT(), l); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 return result; | 819 return result; |
824 } | 820 } |
825 | 821 |
826 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 822 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
827 l->append("<MSG>"); | 823 l->append("<MSG>"); |
828 } | 824 } |
829 | 825 |
830 #endif // OS_WIN | 826 #endif // OS_WIN |
831 | 827 |
832 } // namespace IPC | 828 } // namespace IPC |
OLD | NEW |