OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/common/common_param_traits.h" | |
6 | |
7 #define IPC_MESSAGE_IMPL | |
8 #include "chrome/common/pepper_file_messages.h" | |
9 | |
10 namespace IPC { | |
11 | |
12 void ParamTraits<webkit::ppapi::DirEntry>::Write(Message* m, | |
13 const param_type& p) { | |
14 WriteParam(m, p.name); | |
15 WriteParam(m, p.is_dir); | |
16 } | |
17 | |
18 bool ParamTraits<webkit::ppapi::DirEntry>::Read(const Message* m, | |
19 void** iter, | |
20 param_type* p) { | |
21 return ReadParam(m, iter, &p->name) && | |
22 ReadParam(m, iter, &p->is_dir); | |
23 } | |
24 | |
25 void ParamTraits<webkit::ppapi::DirEntry>::Log(const param_type& p, | |
26 std::string* l) { | |
27 l->append("("); | |
28 LogParam(p.name, l); | |
29 l->append(", "); | |
30 LogParam(p.is_dir, l); | |
31 l->append(")"); | |
32 } | |
33 | |
34 void ParamTraits<webkit::ppapi::PepperFilePath>::Write(Message* m, | |
35 const param_type& p) { | |
36 WriteParam(m, static_cast<unsigned>(p.domain())); | |
37 WriteParam(m, p.path()); | |
38 } | |
39 | |
40 bool ParamTraits<webkit::ppapi::PepperFilePath>::Read(const Message* m, | |
41 void** iter, | |
42 param_type* p) { | |
43 unsigned domain; | |
44 FilePath path; | |
45 if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path)) | |
46 return false; | |
47 if (domain > webkit::ppapi::PepperFilePath::DOMAIN_MAX_VALID) | |
48 return false; | |
49 | |
50 *p = webkit::ppapi::PepperFilePath( | |
51 static_cast<webkit::ppapi::PepperFilePath::Domain>(domain), path); | |
52 return true; | |
53 } | |
54 | |
55 void ParamTraits<webkit::ppapi::PepperFilePath>::Log(const param_type& p, | |
56 std::string* l) { | |
57 l->append("("); | |
58 LogParam(static_cast<unsigned>(p.domain()), l); | |
59 l->append(", "); | |
60 LogParam(p.path(), l); | |
61 l->append(")"); | |
62 } | |
63 | |
64 } // namespace IPC | |
OLD | NEW |