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 "ppapi/proxy/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/dev/pp_file_info_dev.h" | 9 #include "ppapi/c/pp_file_info.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/private/ppb_flash_tcp_socket.h" | 11 #include "ppapi/c/private/ppb_flash_tcp_socket.h" |
12 #include "ppapi/proxy/host_resource.h" | 12 #include "ppapi/proxy/host_resource.h" |
13 #include "ppapi/proxy/interface_proxy.h" | 13 #include "ppapi/proxy/interface_proxy.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
15 #include "ppapi/proxy/serialized_var.h" | 15 #include "ppapi/proxy/serialized_var.h" |
16 #include "ppapi/proxy/serialized_flash_menu.h" | 16 #include "ppapi/proxy/serialized_flash_menu.h" |
17 | 17 |
18 namespace IPC { | 18 namespace IPC { |
19 | 19 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (!ParamTraits<bool>::Read(m, iter, &result)) | 90 if (!ParamTraits<bool>::Read(m, iter, &result)) |
91 return false; | 91 return false; |
92 *r = pp::proxy::BoolToPPBool(result); | 92 *r = pp::proxy::BoolToPPBool(result); |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { | 97 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { |
98 } | 98 } |
99 | 99 |
100 // PP_FileInfo_Dev ------------------------------------------------------------- | 100 // PP_FileInfo ------------------------------------------------------------- |
101 | 101 |
102 // static | 102 // static |
103 void ParamTraits<PP_FileInfo_Dev>::Write(Message* m, const param_type& p) { | 103 void ParamTraits<PP_FileInfo>::Write(Message* m, const param_type& p) { |
104 ParamTraits<int64_t>::Write(m, p.size); | 104 ParamTraits<int64_t>::Write(m, p.size); |
105 ParamTraits<int>::Write(m, static_cast<int>(p.type)); | 105 ParamTraits<int>::Write(m, static_cast<int>(p.type)); |
106 ParamTraits<int>::Write(m, static_cast<int>(p.system_type)); | 106 ParamTraits<int>::Write(m, static_cast<int>(p.system_type)); |
107 ParamTraits<double>::Write(m, p.creation_time); | 107 ParamTraits<double>::Write(m, p.creation_time); |
108 ParamTraits<double>::Write(m, p.last_access_time); | 108 ParamTraits<double>::Write(m, p.last_access_time); |
109 ParamTraits<double>::Write(m, p.last_modified_time); | 109 ParamTraits<double>::Write(m, p.last_modified_time); |
110 } | 110 } |
111 | 111 |
112 // static | 112 // static |
113 bool ParamTraits<PP_FileInfo_Dev>::Read(const Message* m, void** iter, | 113 bool ParamTraits<PP_FileInfo>::Read(const Message* m, void** iter, |
114 param_type* r) { | 114 param_type* r) { |
115 int type, system_type; | 115 int type, system_type; |
116 if (!ParamTraits<int64_t>::Read(m, iter, &r->size) || | 116 if (!ParamTraits<int64_t>::Read(m, iter, &r->size) || |
117 !ParamTraits<int>::Read(m, iter, &type) || | 117 !ParamTraits<int>::Read(m, iter, &type) || |
118 !ParamTraits<int>::Read(m, iter, &system_type) || | 118 !ParamTraits<int>::Read(m, iter, &system_type) || |
119 !ParamTraits<double>::Read(m, iter, &r->creation_time) || | 119 !ParamTraits<double>::Read(m, iter, &r->creation_time) || |
120 !ParamTraits<double>::Read(m, iter, &r->last_access_time) || | 120 !ParamTraits<double>::Read(m, iter, &r->last_access_time) || |
121 !ParamTraits<double>::Read(m, iter, &r->last_modified_time)) | 121 !ParamTraits<double>::Read(m, iter, &r->last_modified_time)) |
122 return false; | 122 return false; |
123 if (type != PP_FILETYPE_REGULAR && | 123 if (type != PP_FILETYPE_REGULAR && |
124 type != PP_FILETYPE_DIRECTORY && | 124 type != PP_FILETYPE_DIRECTORY && |
125 type != PP_FILETYPE_OTHER) | 125 type != PP_FILETYPE_OTHER) |
126 return false; | 126 return false; |
127 r->type = static_cast<PP_FileType_Dev>(type); | 127 r->type = static_cast<PP_FileType>(type); |
128 if (system_type != PP_FILESYSTEMTYPE_EXTERNAL && | 128 if (system_type != PP_FILESYSTEMTYPE_EXTERNAL && |
129 system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && | 129 system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
130 system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) | 130 system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) |
131 return false; | 131 return false; |
132 r->system_type = static_cast<PP_FileSystemType_Dev>(system_type); | 132 r->system_type = static_cast<PP_FileSystemType>(system_type); |
133 return true; | 133 return true; |
134 } | 134 } |
135 | 135 |
136 // static | 136 // static |
137 void ParamTraits<PP_FileInfo_Dev>::Log(const param_type& p, std::string* l) { | 137 void ParamTraits<PP_FileInfo>::Log(const param_type& p, std::string* l) { |
138 } | 138 } |
139 | 139 |
140 // PP_Flash_NetAddress --------------------------------------------------------- | 140 // PP_Flash_NetAddress --------------------------------------------------------- |
141 | 141 |
142 // static | 142 // static |
143 void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) { | 143 void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) { |
144 WriteParam(m, p.size); | 144 WriteParam(m, p.size); |
145 m->WriteBytes(p.data, static_cast<int>(p.size)); | 145 m->WriteBytes(p.data, static_cast<int>(p.size)); |
146 } | 146 } |
147 | 147 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 param_type* r) { | 501 param_type* r) { |
502 return r->ReadFromMessage(m, iter); | 502 return r->ReadFromMessage(m, iter); |
503 } | 503 } |
504 | 504 |
505 // static | 505 // static |
506 void ParamTraits<pp::proxy::SerializedFlashMenu>::Log(const param_type& p, | 506 void ParamTraits<pp::proxy::SerializedFlashMenu>::Log(const param_type& p, |
507 std::string* l) { | 507 std::string* l) { |
508 } | 508 } |
509 | 509 |
510 } // namespace IPC | 510 } // namespace IPC |
OLD | NEW |