OLD | NEW |
1 // Copyright (c) 2011 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 "content/common/pepper_file_messages.h" | 5 #include "content/common/pepper_file_messages.h" |
6 | 6 |
7 namespace IPC { | 7 namespace IPC { |
8 | 8 |
9 void ParamTraits<webkit::ppapi::PepperFilePath>::Write(Message* m, | 9 void ParamTraits<webkit::ppapi::PepperFilePath>::Write(Message* m, |
10 const param_type& p) { | 10 const param_type& p) { |
11 WriteParam(m, static_cast<unsigned>(p.domain())); | 11 WriteParam(m, static_cast<unsigned>(p.domain())); |
12 WriteParam(m, p.path()); | 12 WriteParam(m, p.path()); |
13 } | 13 } |
14 | 14 |
15 bool ParamTraits<webkit::ppapi::PepperFilePath>::Read(const Message* m, | 15 bool ParamTraits<webkit::ppapi::PepperFilePath>::Read(const Message* m, |
16 void** iter, | 16 PickleIterator* iter, |
17 param_type* p) { | 17 param_type* p) { |
18 unsigned domain; | 18 unsigned domain; |
19 FilePath path; | 19 FilePath path; |
20 if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path)) | 20 if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path)) |
21 return false; | 21 return false; |
22 if (domain > webkit::ppapi::PepperFilePath::DOMAIN_MAX_VALID) | 22 if (domain > webkit::ppapi::PepperFilePath::DOMAIN_MAX_VALID) |
23 return false; | 23 return false; |
24 | 24 |
25 *p = webkit::ppapi::PepperFilePath( | 25 *p = webkit::ppapi::PepperFilePath( |
26 static_cast<webkit::ppapi::PepperFilePath::Domain>(domain), path); | 26 static_cast<webkit::ppapi::PepperFilePath::Domain>(domain), path); |
27 return true; | 27 return true; |
28 } | 28 } |
29 | 29 |
30 void ParamTraits<webkit::ppapi::PepperFilePath>::Log(const param_type& p, | 30 void ParamTraits<webkit::ppapi::PepperFilePath>::Log(const param_type& p, |
31 std::string* l) { | 31 std::string* l) { |
32 l->append("("); | 32 l->append("("); |
33 LogParam(static_cast<unsigned>(p.domain()), l); | 33 LogParam(static_cast<unsigned>(p.domain()), l); |
34 l->append(", "); | 34 l->append(", "); |
35 LogParam(p.path(), l); | 35 LogParam(p.path(), l); |
36 l->append(")"); | 36 l->append(")"); |
37 } | 37 } |
38 | 38 |
39 } // namespace IPC | 39 } // namespace IPC |
OLD | NEW |