| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/render_messages_params.h" | 5 #include "chrome/common/render_messages_params.h" |
| 6 | 6 |
| 7 #include "chrome/common/navigation_gesture.h" | 7 #include "chrome/common/navigation_gesture.h" |
| 8 #include "chrome/common/common_param_traits.h" | 8 #include "chrome/common/common_param_traits.h" |
| 9 #include "chrome/common/indexed_db_param_traits.h" | 9 #include "chrome/common/indexed_db_param_traits.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) | 205 val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) |
| 206 return false; | 206 return false; |
| 207 *p = static_cast<param_type>(val); | 207 *p = static_cast<param_type>(val); |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 static void Log(const param_type& p, std::string* l) { | 210 static void Log(const param_type& p, std::string* l) { |
| 211 ParamTraits<int>::Log(static_cast<int>(p), l); | 211 ParamTraits<int>::Log(static_cast<int>(p), l); |
| 212 } | 212 } |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 template <> |
| 216 struct ParamTraits<Extension::Location> { |
| 217 typedef Extension::Location param_type; |
| 218 static void Write(Message* m, const param_type& p) { |
| 219 int val = static_cast<int>(p); |
| 220 WriteParam(m, val); |
| 221 } |
| 222 static bool Read(const Message* m, void** iter, param_type* p) { |
| 223 int val = 0; |
| 224 if (!ReadParam(m, iter, &val) || |
| 225 val < Extension::INVALID || |
| 226 val >= Extension::EXTERNAL_PREF_DOWNLOAD) |
| 227 return false; |
| 228 *p = static_cast<param_type>(val); |
| 229 return true; |
| 230 } |
| 231 static void Log(const param_type& p, std::string* l) { |
| 232 ParamTraits<int>::Log(static_cast<int>(p), l); |
| 233 } |
| 234 }; |
| 235 |
| 236 |
| 215 void ParamTraits<ViewMsg_Navigate_Params>::Write(Message* m, | 237 void ParamTraits<ViewMsg_Navigate_Params>::Write(Message* m, |
| 216 const param_type& p) { | 238 const param_type& p) { |
| 217 WriteParam(m, p.page_id); | 239 WriteParam(m, p.page_id); |
| 218 WriteParam(m, p.pending_history_list_offset); | 240 WriteParam(m, p.pending_history_list_offset); |
| 219 WriteParam(m, p.current_history_list_offset); | 241 WriteParam(m, p.current_history_list_offset); |
| 220 WriteParam(m, p.current_history_list_length); | 242 WriteParam(m, p.current_history_list_length); |
| 221 WriteParam(m, p.url); | 243 WriteParam(m, p.url); |
| 222 WriteParam(m, p.referrer); | 244 WriteParam(m, p.referrer); |
| 223 WriteParam(m, p.transition); | 245 WriteParam(m, p.transition); |
| 224 WriteParam(m, p.state); | 246 WriteParam(m, p.state); |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 l->append(", "); | 1284 l->append(", "); |
| 1263 LogParam(p.default_file_name, l); | 1285 LogParam(p.default_file_name, l); |
| 1264 } | 1286 } |
| 1265 | 1287 |
| 1266 void ParamTraits<ViewMsg_ExtensionRendererInfo>::Write(Message* m, | 1288 void ParamTraits<ViewMsg_ExtensionRendererInfo>::Write(Message* m, |
| 1267 const param_type& p) { | 1289 const param_type& p) { |
| 1268 WriteParam(m, p.id); | 1290 WriteParam(m, p.id); |
| 1269 WriteParam(m, p.web_extent); | 1291 WriteParam(m, p.web_extent); |
| 1270 WriteParam(m, p.name); | 1292 WriteParam(m, p.name); |
| 1271 WriteParam(m, p.icon_url); | 1293 WriteParam(m, p.icon_url); |
| 1294 WriteParam(m, p.location); |
| 1272 } | 1295 } |
| 1273 | 1296 |
| 1274 bool ParamTraits<ViewMsg_ExtensionRendererInfo>::Read(const Message* m, | 1297 bool ParamTraits<ViewMsg_ExtensionRendererInfo>::Read(const Message* m, |
| 1275 void** iter, | 1298 void** iter, |
| 1276 param_type* p) { | 1299 param_type* p) { |
| 1277 return ReadParam(m, iter, &p->id) && | 1300 return ReadParam(m, iter, &p->id) && |
| 1278 ReadParam(m, iter, &p->web_extent) && | 1301 ReadParam(m, iter, &p->web_extent) && |
| 1279 ReadParam(m, iter, &p->name) && | 1302 ReadParam(m, iter, &p->name) && |
| 1280 ReadParam(m, iter, &p->icon_url); | 1303 ReadParam(m, iter, &p->icon_url) && |
| 1304 ReadParam(m, iter, &p->location); |
| 1281 } | 1305 } |
| 1282 | 1306 |
| 1283 void ParamTraits<ViewMsg_ExtensionRendererInfo>::Log(const param_type& p, | 1307 void ParamTraits<ViewMsg_ExtensionRendererInfo>::Log(const param_type& p, |
| 1284 std::string* l) { | 1308 std::string* l) { |
| 1285 LogParam(p.id, l); | 1309 LogParam(p.id, l); |
| 1286 } | 1310 } |
| 1287 | 1311 |
| 1288 void ParamTraits<ViewMsg_ExtensionsUpdated_Params>::Write( | 1312 void ParamTraits<ViewMsg_ExtensionsUpdated_Params>::Write( |
| 1289 Message* m, | 1313 Message* m, |
| 1290 const param_type& p) { | 1314 const param_type& p) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 l->append(", "); | 1441 l->append(", "); |
| 1418 LogParam(p.origin_url, l); | 1442 LogParam(p.origin_url, l); |
| 1419 l->append(", "); | 1443 l->append(", "); |
| 1420 LogParam(p.type, l); | 1444 LogParam(p.type, l); |
| 1421 l->append(", "); | 1445 l->append(", "); |
| 1422 LogParam(p.requested_size, l); | 1446 LogParam(p.requested_size, l); |
| 1423 l->append(")"); | 1447 l->append(")"); |
| 1424 } | 1448 } |
| 1425 | 1449 |
| 1426 } // namespace IPC | 1450 } // namespace IPC |
| OLD | NEW |