| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 WriteParam(m, p.is_last_chunk()); | 157 WriteParam(m, p.is_last_chunk()); |
| 158 break; | 158 break; |
| 159 } | 159 } |
| 160 case net::UploadData::TYPE_FILE: { | 160 case net::UploadData::TYPE_FILE: { |
| 161 WriteParam(m, p.file_path()); | 161 WriteParam(m, p.file_path()); |
| 162 WriteParam(m, p.file_range_offset()); | 162 WriteParam(m, p.file_range_offset()); |
| 163 WriteParam(m, p.file_range_length()); | 163 WriteParam(m, p.file_range_length()); |
| 164 WriteParam(m, p.expected_file_modification_time()); | 164 WriteParam(m, p.expected_file_modification_time()); |
| 165 break; | 165 break; |
| 166 } | 166 } |
| 167 case net::UploadData::TYPE_FILE_FILESYSTEM: { |
| 168 WriteParam(m, p.url()); |
| 169 WriteParam(m, p.file_range_offset()); |
| 170 WriteParam(m, p.file_range_length()); |
| 171 WriteParam(m, p.expected_file_modification_time()); |
| 172 break; |
| 173 } |
| 167 default: { | 174 default: { |
| 168 WriteParam(m, p.blob_url()); | 175 WriteParam(m, p.url()); |
| 169 break; | 176 break; |
| 170 } | 177 } |
| 171 } | 178 } |
| 172 } | 179 } |
| 173 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 180 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
| 174 int type; | 181 int type; |
| 175 if (!ReadParam(m, iter, &type)) | 182 if (!ReadParam(m, iter, &type)) |
| 176 return false; | 183 return false; |
| 177 switch (type) { | 184 switch (type) { |
| 178 case net::UploadData::TYPE_BYTES: { | 185 case net::UploadData::TYPE_BYTES: { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 207 if (!ReadParam(m, iter, &offset)) | 214 if (!ReadParam(m, iter, &offset)) |
| 208 return false; | 215 return false; |
| 209 if (!ReadParam(m, iter, &length)) | 216 if (!ReadParam(m, iter, &length)) |
| 210 return false; | 217 return false; |
| 211 if (!ReadParam(m, iter, &expected_modification_time)) | 218 if (!ReadParam(m, iter, &expected_modification_time)) |
| 212 return false; | 219 return false; |
| 213 r->SetToFilePathRange(file_path, offset, length, | 220 r->SetToFilePathRange(file_path, offset, length, |
| 214 expected_modification_time); | 221 expected_modification_time); |
| 215 break; | 222 break; |
| 216 } | 223 } |
| 224 case net::UploadData::TYPE_FILE_FILESYSTEM: { |
| 225 GURL url; |
| 226 uint64 offset, length; |
| 227 base::Time expected_modification_time; |
| 228 if (!ReadParam(m, iter, &url)) |
| 229 return false; |
| 230 if (!ReadParam(m, iter, &offset)) |
| 231 return false; |
| 232 if (!ReadParam(m, iter, &length)) |
| 233 return false; |
| 234 if (!ReadParam(m, iter, &expected_modification_time)) |
| 235 return false; |
| 236 r->SetToFileSystemURLRange(url, offset, length, |
| 237 expected_modification_time); |
| 238 break; |
| 239 } |
| 217 default: { | 240 default: { |
| 218 DCHECK(type == net::UploadData::TYPE_BLOB); | 241 DCHECK(type == net::UploadData::TYPE_BLOB); |
| 219 GURL blob_url; | 242 GURL blob_url; |
| 220 if (!ReadParam(m, iter, &blob_url)) | 243 if (!ReadParam(m, iter, &blob_url)) |
| 221 return false; | 244 return false; |
| 222 r->SetToBlobUrl(blob_url); | 245 r->SetToBlobUrl(blob_url); |
| 223 break; | 246 break; |
| 224 } | 247 } |
| 225 } | 248 } |
| 226 return true; | 249 return true; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 550 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 528 #include "content/public/common/common_param_traits_macros.h" | 551 #include "content/public/common/common_param_traits_macros.h" |
| 529 } // namespace IPC | 552 } // namespace IPC |
| 530 | 553 |
| 531 // Generate param traits log methods. | 554 // Generate param traits log methods. |
| 532 #include "ipc/param_traits_log_macros.h" | 555 #include "ipc/param_traits_log_macros.h" |
| 533 namespace IPC { | 556 namespace IPC { |
| 534 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 557 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 535 #include "content/public/common/common_param_traits_macros.h" | 558 #include "content/public/common/common_param_traits_macros.h" |
| 536 } // namespace IPC | 559 } // namespace IPC |
| OLD | NEW |