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 "content/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include "content/public/common/content_constants.h" | 7 #include "content/public/common/content_constants.h" |
8 #include "content/public/common/referrer.h" | 8 #include "content/public/common/referrer.h" |
9 #include "net/base/host_port_pair.h" | 9 #include "net/base/host_port_pair.h" |
10 #include "net/base/upload_data.h" | 10 #include "net/base/upload_data.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 m->WriteData(p.bytes(), static_cast<int>(p.length())); | 237 m->WriteData(p.bytes(), static_cast<int>(p.length())); |
238 break; | 238 break; |
239 } | 239 } |
240 case webkit_base::DataElement::TYPE_FILE: { | 240 case webkit_base::DataElement::TYPE_FILE: { |
241 WriteParam(m, p.path()); | 241 WriteParam(m, p.path()); |
242 WriteParam(m, p.offset()); | 242 WriteParam(m, p.offset()); |
243 WriteParam(m, p.length()); | 243 WriteParam(m, p.length()); |
244 WriteParam(m, p.expected_modification_time()); | 244 WriteParam(m, p.expected_modification_time()); |
245 break; | 245 break; |
246 } | 246 } |
| 247 case webkit_base::DataElement::TYPE_FILE_FILESYSTEM: { |
| 248 WriteParam(m, p.url()); |
| 249 WriteParam(m, p.offset()); |
| 250 WriteParam(m, p.length()); |
| 251 WriteParam(m, p.expected_modification_time()); |
| 252 break; |
| 253 } |
247 default: { | 254 default: { |
| 255 DCHECK(p.type() == webkit_base::DataElement::TYPE_BLOB); |
248 WriteParam(m, p.url()); | 256 WriteParam(m, p.url()); |
249 break; | 257 break; |
250 } | 258 } |
251 } | 259 } |
252 } | 260 } |
253 | 261 |
254 bool ParamTraits<webkit_base::DataElement>::Read( | 262 bool ParamTraits<webkit_base::DataElement>::Read( |
255 const Message* m, PickleIterator* iter, param_type* r) { | 263 const Message* m, PickleIterator* iter, param_type* r) { |
256 int type; | 264 int type; |
257 if (!ReadParam(m, iter, &type)) | 265 if (!ReadParam(m, iter, &type)) |
(...skipping 16 matching lines...) Expand all Loading... |
274 if (!ReadParam(m, iter, &offset)) | 282 if (!ReadParam(m, iter, &offset)) |
275 return false; | 283 return false; |
276 if (!ReadParam(m, iter, &length)) | 284 if (!ReadParam(m, iter, &length)) |
277 return false; | 285 return false; |
278 if (!ReadParam(m, iter, &expected_modification_time)) | 286 if (!ReadParam(m, iter, &expected_modification_time)) |
279 return false; | 287 return false; |
280 r->SetToFilePathRange(file_path, offset, length, | 288 r->SetToFilePathRange(file_path, offset, length, |
281 expected_modification_time); | 289 expected_modification_time); |
282 break; | 290 break; |
283 } | 291 } |
| 292 case webkit_base::DataElement::TYPE_FILE_FILESYSTEM: { |
| 293 GURL file_system_url; |
| 294 uint64 offset, length; |
| 295 base::Time expected_modification_time; |
| 296 if (!ReadParam(m, iter, &file_system_url)) |
| 297 return false; |
| 298 if (!ReadParam(m, iter, &offset)) |
| 299 return false; |
| 300 if (!ReadParam(m, iter, &length)) |
| 301 return false; |
| 302 if (!ReadParam(m, iter, &expected_modification_time)) |
| 303 return false; |
| 304 r->SetToFileSystemUrlRange(file_system_url, offset, length, |
| 305 expected_modification_time); |
| 306 break; |
| 307 } |
284 default: { | 308 default: { |
285 DCHECK(type == webkit_base::DataElement::TYPE_BLOB); | 309 DCHECK(type == webkit_base::DataElement::TYPE_BLOB); |
286 GURL blob_url; | 310 GURL blob_url; |
287 if (!ReadParam(m, iter, &blob_url)) | 311 if (!ReadParam(m, iter, &blob_url)) |
288 return false; | 312 return false; |
289 r->SetToBlobUrl(blob_url); | 313 r->SetToBlobUrl(blob_url); |
290 break; | 314 break; |
291 } | 315 } |
292 } | 316 } |
293 return true; | 317 return true; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 616 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
593 #include "content/public/common/common_param_traits_macros.h" | 617 #include "content/public/common/common_param_traits_macros.h" |
594 } // namespace IPC | 618 } // namespace IPC |
595 | 619 |
596 // Generate param traits log methods. | 620 // Generate param traits log methods. |
597 #include "ipc/param_traits_log_macros.h" | 621 #include "ipc/param_traits_log_macros.h" |
598 namespace IPC { | 622 namespace IPC { |
599 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 623 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
600 #include "content/public/common/common_param_traits_macros.h" | 624 #include "content/public/common/common_param_traits_macros.h" |
601 } // namespace IPC | 625 } // namespace IPC |
OLD | NEW |