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/common/resource_messages.h" | 5 #include "content/common/resource_messages.h" |
6 | 6 |
7 #include "net/base/load_timing_info.h" | 7 #include "net/base/load_timing_info.h" |
8 #include "net/http/http_response_headers.h" | 8 #include "net/http/http_response_headers.h" |
9 | 9 |
10 namespace IPC { | 10 namespace IPC { |
11 | 11 |
12 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( | 12 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( |
13 Message* m, const param_type& p) { | 13 Message* m, const param_type& p) { |
14 WriteParam(m, p.get() != NULL); | 14 WriteParam(m, p.get() != NULL); |
15 if (p.get()) { | 15 if (p.get()) { |
16 // Do not disclose Set-Cookie headers over IPC. | 16 // Do not disclose Set-Cookie headers over IPC. |
17 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); | 17 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( | 21 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( |
22 const Message* m, PickleIterator* iter, param_type* r) { | 22 const Message* m, PickleIterator* iter, param_type* r) { |
23 bool has_object; | 23 bool has_object; |
24 if (!ReadParam(m, iter, &has_object)) | 24 if (!ReadParam(m, iter, &has_object)) |
25 return false; | 25 return false; |
26 if (has_object) | 26 if (has_object) |
27 *r = new net::HttpResponseHeaders(*m, iter); | 27 *r = new net::HttpResponseHeaders(iter); |
28 return true; | 28 return true; |
29 } | 29 } |
30 | 30 |
31 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( | 31 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( |
32 const param_type& p, std::string* l) { | 32 const param_type& p, std::string* l) { |
33 l->append("<HttpResponseHeaders>"); | 33 l->append("<HttpResponseHeaders>"); |
34 } | 34 } |
35 | 35 |
36 void ParamTraits<storage::DataElement>::Write(Message* m, const param_type& p) { | 36 void ParamTraits<storage::DataElement>::Write(Message* m, const param_type& p) { |
37 WriteParam(m, static_cast<int>(p.type())); | 37 WriteParam(m, static_cast<int>(p.type())); |
(...skipping 29 matching lines...) Expand all Loading... |
67 bool ParamTraits<storage::DataElement>::Read(const Message* m, | 67 bool ParamTraits<storage::DataElement>::Read(const Message* m, |
68 PickleIterator* iter, | 68 PickleIterator* iter, |
69 param_type* r) { | 69 param_type* r) { |
70 int type; | 70 int type; |
71 if (!ReadParam(m, iter, &type)) | 71 if (!ReadParam(m, iter, &type)) |
72 return false; | 72 return false; |
73 switch (type) { | 73 switch (type) { |
74 case storage::DataElement::TYPE_BYTES: { | 74 case storage::DataElement::TYPE_BYTES: { |
75 const char* data; | 75 const char* data; |
76 int len; | 76 int len; |
77 if (!m->ReadData(iter, &data, &len)) | 77 if (!iter->ReadData(&data, &len)) |
78 return false; | 78 return false; |
79 r->SetToBytes(data, len); | 79 r->SetToBytes(data, len); |
80 break; | 80 break; |
81 } | 81 } |
82 case storage::DataElement::TYPE_FILE: { | 82 case storage::DataElement::TYPE_FILE: { |
83 base::FilePath file_path; | 83 base::FilePath file_path; |
84 uint64 offset, length; | 84 uint64 offset, length; |
85 base::Time expected_modification_time; | 85 base::Time expected_modification_time; |
86 if (!ReadParam(m, iter, &file_path)) | 86 if (!ReadParam(m, iter, &file_path)) |
87 return false; | 87 return false; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 (*r)->set_identifier(identifier); | 288 (*r)->set_identifier(identifier); |
289 return true; | 289 return true; |
290 } | 290 } |
291 | 291 |
292 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log( | 292 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log( |
293 const param_type& p, std::string* l) { | 293 const param_type& p, std::string* l) { |
294 l->append("<ResourceRequestBody>"); | 294 l->append("<ResourceRequestBody>"); |
295 } | 295 } |
296 | 296 |
297 } // namespace IPC | 297 } // namespace IPC |
OLD | NEW |