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 #include "webkit/glue/resource_loader_bridge.h" | 9 #include "webkit/glue/resource_loader_bridge.h" |
10 | 10 |
11 namespace IPC { | 11 namespace IPC { |
12 | 12 |
13 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( | 13 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( |
14 Message* m, const param_type& p) { | 14 Message* m, const param_type& p) { |
15 WriteParam(m, p.get() != NULL); | 15 WriteParam(m, p.get() != NULL); |
16 if (p) { | 16 if (p.get()) { |
17 // Do not disclose Set-Cookie headers over IPC. | 17 // Do not disclose Set-Cookie headers over IPC. |
18 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); | 18 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
22 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( | 22 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( |
23 const Message* m, PickleIterator* iter, param_type* r) { | 23 const Message* m, PickleIterator* iter, param_type* r) { |
24 bool has_object; | 24 bool has_object; |
25 if (!ReadParam(m, iter, &has_object)) | 25 if (!ReadParam(m, iter, &has_object)) |
26 return false; | 26 return false; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 void ParamTraits<webkit_base::DataElement>::Log( | 133 void ParamTraits<webkit_base::DataElement>::Log( |
134 const param_type& p, std::string* l) { | 134 const param_type& p, std::string* l) { |
135 l->append("<webkit_base::DataElement>"); | 135 l->append("<webkit_base::DataElement>"); |
136 } | 136 } |
137 | 137 |
138 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Write( | 138 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Write( |
139 Message* m, const param_type& p) { | 139 Message* m, const param_type& p) { |
140 WriteParam(m, p.get() != NULL); | 140 WriteParam(m, p.get() != NULL); |
141 if (p) { | 141 if (p.get()) { |
142 WriteParam(m, p->http_status_code); | 142 WriteParam(m, p->http_status_code); |
143 WriteParam(m, p->http_status_text); | 143 WriteParam(m, p->http_status_text); |
144 WriteParam(m, p->request_headers); | 144 WriteParam(m, p->request_headers); |
145 WriteParam(m, p->response_headers); | 145 WriteParam(m, p->response_headers); |
146 WriteParam(m, p->request_headers_text); | 146 WriteParam(m, p->request_headers_text); |
147 WriteParam(m, p->response_headers_text); | 147 WriteParam(m, p->response_headers_text); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( | 151 bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( |
152 const Message* m, PickleIterator* iter, param_type* r) { | 152 const Message* m, PickleIterator* iter, param_type* r) { |
153 bool has_object; | 153 bool has_object; |
154 if (!ReadParam(m, iter, &has_object)) | 154 if (!ReadParam(m, iter, &has_object)) |
155 return false; | 155 return false; |
156 if (!has_object) | 156 if (!has_object) |
157 return true; | 157 return true; |
158 *r = new webkit_glue::ResourceDevToolsInfo(); | 158 *r = new webkit_glue::ResourceDevToolsInfo(); |
159 return | 159 return |
160 ReadParam(m, iter, &(*r)->http_status_code) && | 160 ReadParam(m, iter, &(*r)->http_status_code) && |
161 ReadParam(m, iter, &(*r)->http_status_text) && | 161 ReadParam(m, iter, &(*r)->http_status_text) && |
162 ReadParam(m, iter, &(*r)->request_headers) && | 162 ReadParam(m, iter, &(*r)->request_headers) && |
163 ReadParam(m, iter, &(*r)->response_headers) && | 163 ReadParam(m, iter, &(*r)->response_headers) && |
164 ReadParam(m, iter, &(*r)->request_headers_text) && | 164 ReadParam(m, iter, &(*r)->request_headers_text) && |
165 ReadParam(m, iter, &(*r)->response_headers_text); | 165 ReadParam(m, iter, &(*r)->response_headers_text); |
166 } | 166 } |
167 | 167 |
168 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log( | 168 void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log( |
169 const param_type& p, std::string* l) { | 169 const param_type& p, std::string* l) { |
170 l->append("("); | 170 l->append("("); |
171 if (p) { | 171 if (p.get()) { |
172 LogParam(p->request_headers, l); | 172 LogParam(p->request_headers, l); |
173 l->append(", "); | 173 l->append(", "); |
174 LogParam(p->response_headers, l); | 174 LogParam(p->response_headers, l); |
175 } | 175 } |
176 l->append(")"); | 176 l->append(")"); |
177 } | 177 } |
178 | 178 |
179 void ParamTraits<net::LoadTimingInfo>::Write( | 179 void ParamTraits<net::LoadTimingInfo>::Write( |
180 Message* m, const param_type& p) { | 180 Message* m, const param_type& p) { |
181 WriteParam(m, p.socket_log_id); | 181 WriteParam(m, p.socket_log_id); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 LogParam(p.send_end, l); | 257 LogParam(p.send_end, l); |
258 l->append(", "); | 258 l->append(", "); |
259 LogParam(p.receive_headers_end, l); | 259 LogParam(p.receive_headers_end, l); |
260 l->append(")"); | 260 l->append(")"); |
261 } | 261 } |
262 | 262 |
263 void ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Write( | 263 void ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Write( |
264 Message* m, | 264 Message* m, |
265 const param_type& p) { | 265 const param_type& p) { |
266 WriteParam(m, p.get() != NULL); | 266 WriteParam(m, p.get() != NULL); |
267 if (p) { | 267 if (p.get()) { |
268 WriteParam(m, *p->elements()); | 268 WriteParam(m, *p->elements()); |
269 WriteParam(m, p->identifier()); | 269 WriteParam(m, p->identifier()); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 bool ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Read( | 273 bool ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Read( |
274 const Message* m, | 274 const Message* m, |
275 PickleIterator* iter, | 275 PickleIterator* iter, |
276 param_type* r) { | 276 param_type* r) { |
277 bool has_object; | 277 bool has_object; |
(...skipping 12 matching lines...) Expand all Loading... |
290 (*r)->set_identifier(identifier); | 290 (*r)->set_identifier(identifier); |
291 return true; | 291 return true; |
292 } | 292 } |
293 | 293 |
294 void ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Log( | 294 void ParamTraits<scoped_refptr<webkit_glue::ResourceRequestBody> >::Log( |
295 const param_type& p, std::string* l) { | 295 const param_type& p, std::string* l) { |
296 l->append("<webkit_glue::ResourceRequestBody>"); | 296 l->append("<webkit_glue::ResourceRequestBody>"); |
297 } | 297 } |
298 | 298 |
299 } // namespace IPC | 299 } // namespace IPC |
OLD | NEW |