OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings_traits.h" |
5 #include "content/common/common_param_traits.h" | 6 #include "content/common/common_param_traits.h" |
6 | 7 |
7 #define IPC_MESSAGE_IMPL | 8 #define IPC_MESSAGE_IMPL |
8 #include "chrome/common/automation_messages.h" | 9 #include "chrome/common/automation_messages.h" |
9 | |
10 AutomationURLRequest::AutomationURLRequest() | |
11 : resource_type(0), | |
12 load_flags(0) { | |
13 } | |
14 | |
15 AutomationURLRequest::AutomationURLRequest( | |
16 const std::string& in_url, | |
17 const std::string& in_method, | |
18 const std::string& in_referrer, | |
19 const std::string& in_extra_request_headers, | |
20 scoped_refptr<net::UploadData> in_upload_data, | |
21 int in_resource_type, | |
22 int in_load_flags) | |
23 : url(in_url), | |
24 method(in_method), | |
25 referrer(in_referrer), | |
26 extra_request_headers(in_extra_request_headers), | |
27 upload_data(in_upload_data), | |
28 resource_type(in_resource_type), | |
29 load_flags(in_load_flags) { | |
30 } | |
31 | |
32 AutomationURLRequest::~AutomationURLRequest() {} | |
33 | |
34 AutomationURLResponse::AutomationURLResponse() | |
35 : content_length(0), | |
36 redirect_status(0) { | |
37 } | |
38 | |
39 AutomationURLResponse::AutomationURLResponse( | |
40 const std::string& in_mime_type, const std::string& in_headers, | |
41 int64 in_content_length, const base::Time& in_last_modified, | |
42 const std::string& in_redirect_url, int in_redirect_status, | |
43 const net::HostPortPair& host_socket_address) | |
44 : mime_type(in_mime_type), | |
45 headers(in_headers), | |
46 content_length(in_content_length), | |
47 last_modified(in_last_modified), | |
48 redirect_url(in_redirect_url), | |
49 redirect_status(in_redirect_status), | |
50 socket_address(host_socket_address) { | |
51 } | |
52 | |
53 | |
54 AutomationURLResponse::~AutomationURLResponse() {} | |
55 | |
56 ExternalTabSettings::ExternalTabSettings() | |
57 : parent(NULL), | |
58 dimensions(), | |
59 style(0), | |
60 is_incognito(false), | |
61 load_requests_via_automation(false), | |
62 handle_top_level_requests(false), | |
63 initial_url(), | |
64 referrer(), | |
65 infobars_enabled(false), | |
66 route_all_top_level_navigations(false) { | |
67 } | |
68 | |
69 ExternalTabSettings::ExternalTabSettings( | |
70 gfx::NativeWindow in_parent, | |
71 const gfx::Rect& in_dimensions, | |
72 unsigned int in_style, | |
73 bool in_is_incognito, | |
74 bool in_load_requests_via_automation, | |
75 bool in_handle_top_level_requests, | |
76 const GURL& in_initial_url, | |
77 const GURL& in_referrer, | |
78 bool in_infobars_enabled, | |
79 bool in_route_all_top_level_navigations) | |
80 : parent(in_parent), | |
81 dimensions(in_dimensions), | |
82 style(in_style), | |
83 is_incognito(in_is_incognito), | |
84 load_requests_via_automation(in_load_requests_via_automation), | |
85 handle_top_level_requests(in_handle_top_level_requests), | |
86 initial_url(in_initial_url), | |
87 referrer(in_referrer), | |
88 infobars_enabled(in_infobars_enabled), | |
89 route_all_top_level_navigations(in_route_all_top_level_navigations) { | |
90 } | |
91 | |
92 ExternalTabSettings::~ExternalTabSettings() {} | |
93 | |
94 NavigationInfo::NavigationInfo() | |
95 : navigation_type(0), | |
96 relative_offset(0), | |
97 navigation_index(0), | |
98 security_style(SECURITY_STYLE_UNKNOWN), | |
99 displayed_insecure_content(0), | |
100 ran_insecure_content(0) { | |
101 } | |
102 | |
103 NavigationInfo::NavigationInfo(int in_navigation_type, | |
104 int in_relative_offset, | |
105 int in_navigation_index, | |
106 const std::wstring& in_title, | |
107 const GURL& in_url, | |
108 const GURL& in_referrer, | |
109 SecurityStyle in_security_style, | |
110 bool in_displayed_insecure_content, | |
111 bool in_ran_insecure_content) | |
112 : navigation_type(in_navigation_type), | |
113 relative_offset(in_relative_offset), | |
114 navigation_index(in_navigation_index), | |
115 title(in_title), | |
116 url(in_url), | |
117 referrer(in_referrer), | |
118 security_style(in_security_style), | |
119 displayed_insecure_content(in_displayed_insecure_content), | |
120 ran_insecure_content(in_ran_insecure_content) { | |
121 } | |
122 | |
123 NavigationInfo::~NavigationInfo() {} | |
124 | |
125 MiniContextMenuParams::MiniContextMenuParams() | |
126 : screen_x(0), | |
127 screen_y(0) { | |
128 } | |
129 | |
130 MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, | |
131 int in_screen_y, | |
132 const GURL& in_link_url, | |
133 const GURL& in_unfiltered_link_url, | |
134 const GURL& in_src_url, | |
135 const GURL& in_page_url, | |
136 const GURL& in_frame_url) | |
137 : screen_x(in_screen_x), | |
138 screen_y(in_screen_y), | |
139 link_url(in_link_url), | |
140 unfiltered_link_url(in_unfiltered_link_url), | |
141 src_url(in_src_url), | |
142 page_url(in_page_url), | |
143 frame_url(in_frame_url) { | |
144 } | |
145 | |
146 MiniContextMenuParams::~MiniContextMenuParams() {} | |
147 | |
148 AttachExternalTabParams::AttachExternalTabParams() | |
149 : cookie(0), | |
150 disposition(0), | |
151 user_gesture(false) { | |
152 } | |
153 | |
154 AttachExternalTabParams::AttachExternalTabParams( | |
155 uint64 in_cookie, | |
156 const GURL& in_url, | |
157 const gfx::Rect& in_dimensions, | |
158 int in_disposition, | |
159 bool in_user_gesture, | |
160 const std::string& in_profile_name) | |
161 : cookie(in_cookie), | |
162 url(in_url), | |
163 dimensions(in_dimensions), | |
164 disposition(in_disposition), | |
165 user_gesture(in_user_gesture), | |
166 profile_name(in_profile_name) { | |
167 } | |
168 | |
169 AttachExternalTabParams::~AttachExternalTabParams() {} | |
170 | |
171 namespace IPC { | |
172 | |
173 // static | |
174 void ParamTraits<AutomationMsg_Find_Params>::Write(Message* m, | |
175 const param_type& p) { | |
176 WriteParam(m, p.unused); | |
177 WriteParam(m, p.search_string); | |
178 WriteParam(m, p.forward); | |
179 WriteParam(m, p.match_case); | |
180 WriteParam(m, p.find_next); | |
181 } | |
182 | |
183 // static | |
184 bool ParamTraits<AutomationMsg_Find_Params>::Read(const Message* m, | |
185 void** iter, | |
186 param_type* p) { | |
187 return | |
188 ReadParam(m, iter, &p->unused) && | |
189 ReadParam(m, iter, &p->search_string) && | |
190 ReadParam(m, iter, &p->forward) && | |
191 ReadParam(m, iter, &p->match_case) && | |
192 ReadParam(m, iter, &p->find_next); | |
193 } | |
194 | |
195 // static | |
196 void ParamTraits<AutomationMsg_Find_Params>::Log(const param_type& p, | |
197 std::string* l) { | |
198 l->append("<AutomationMsg_Find_Params>"); | |
199 } | |
200 | |
201 // static | |
202 void ParamTraits<AutomationMsg_NavigationResponseValues>::Write( | |
203 Message* m, | |
204 const param_type& p) { | |
205 m->WriteInt(p); | |
206 } | |
207 | |
208 // static | |
209 bool ParamTraits<AutomationMsg_NavigationResponseValues>::Read(const Message* m, | |
210 void** iter, | |
211 param_type* p) { | |
212 int type; | |
213 if (!m->ReadInt(iter, &type)) | |
214 return false; | |
215 *p = static_cast<AutomationMsg_NavigationResponseValues>(type); | |
216 return true; | |
217 } | |
218 | |
219 // static | |
220 void ParamTraits<AutomationMsg_NavigationResponseValues>::Log( | |
221 const param_type& p, std::string* l) { | |
222 std::string control; | |
223 switch (p) { | |
224 case AUTOMATION_MSG_NAVIGATION_ERROR: | |
225 control = "AUTOMATION_MSG_NAVIGATION_ERROR"; | |
226 break; | |
227 case AUTOMATION_MSG_NAVIGATION_SUCCESS: | |
228 control = "AUTOMATION_MSG_NAVIGATION_SUCCESS"; | |
229 break; | |
230 case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: | |
231 control = "AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; | |
232 break; | |
233 default: | |
234 control = "UNKNOWN"; | |
235 break; | |
236 } | |
237 | |
238 LogParam(control, l); | |
239 } | |
240 | |
241 // static | |
242 void ParamTraits<AutomationMsg_ExtensionResponseValues>::Write( | |
243 Message* m, | |
244 const param_type& p) { | |
245 m->WriteInt(p); | |
246 } | |
247 | |
248 // static | |
249 bool ParamTraits<AutomationMsg_ExtensionResponseValues>::Read( | |
250 const Message* m, | |
251 void** iter, | |
252 param_type* p) { | |
253 int type; | |
254 if (!m->ReadInt(iter, &type)) | |
255 return false; | |
256 *p = static_cast<AutomationMsg_ExtensionResponseValues>(type); | |
257 return true; | |
258 } | |
259 | |
260 // static | |
261 void ParamTraits<AutomationMsg_ExtensionResponseValues>::Log( | |
262 const param_type& p, | |
263 std::string* l) { | |
264 std::string control; | |
265 switch (p) { | |
266 case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED: | |
267 control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED"; | |
268 break; | |
269 case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED: | |
270 control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED"; | |
271 break; | |
272 default: | |
273 control = "UNKNOWN"; | |
274 break; | |
275 } | |
276 | |
277 LogParam(control, l); | |
278 } | |
279 | |
280 // static | |
281 void ParamTraits<AutomationMsg_ExtensionProperty>::Write(Message* m, | |
282 const param_type& p) { | |
283 m->WriteInt(p); | |
284 } | |
285 | |
286 // static | |
287 bool ParamTraits<AutomationMsg_ExtensionProperty>::Read(const Message* m, | |
288 void** iter, | |
289 param_type* p) { | |
290 int type; | |
291 if (!m->ReadInt(iter, &type)) | |
292 return false; | |
293 *p = static_cast<AutomationMsg_ExtensionProperty>(type); | |
294 return true; | |
295 } | |
296 | |
297 // static | |
298 void ParamTraits<AutomationMsg_ExtensionProperty>::Log(const param_type& p, | |
299 std::string* l) { | |
300 std::string control; | |
301 switch (p) { | |
302 case AUTOMATION_MSG_EXTENSION_ID: | |
303 control = "AUTOMATION_MSG_EXTENSION_ID"; | |
304 break; | |
305 case AUTOMATION_MSG_EXTENSION_NAME: | |
306 control = "AUTOMATION_MSG_EXTENSION_NAME"; | |
307 break; | |
308 case AUTOMATION_MSG_EXTENSION_VERSION: | |
309 control = "AUTOMATION_MSG_EXTENSION_VERSION"; | |
310 break; | |
311 case AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX: | |
312 control = "AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX"; | |
313 break; | |
314 default: | |
315 control = "UNKNOWN"; | |
316 break; | |
317 } | |
318 | |
319 LogParam(control, l); | |
320 } | |
321 | |
322 // static | |
323 void ParamTraits<SecurityStyle>::Write(Message* m, const param_type& p) { | |
324 m->WriteInt(p); | |
325 } | |
326 | |
327 // static | |
328 bool ParamTraits<SecurityStyle>::Read(const Message* m, | |
329 void** iter, | |
330 param_type* p) { | |
331 int type; | |
332 if (!m->ReadInt(iter, &type)) | |
333 return false; | |
334 *p = static_cast<SecurityStyle>(type); | |
335 return true; | |
336 } | |
337 | |
338 // static | |
339 void ParamTraits<SecurityStyle>::Log(const param_type& p, std::string* l) { | |
340 std::string control; | |
341 switch (p) { | |
342 case SECURITY_STYLE_UNKNOWN: | |
343 control = "SECURITY_STYLE_UNKNOWN"; | |
344 break; | |
345 case SECURITY_STYLE_UNAUTHENTICATED: | |
346 control = "SECURITY_STYLE_UNAUTHENTICATED"; | |
347 break; | |
348 case SECURITY_STYLE_AUTHENTICATION_BROKEN: | |
349 control = "SECURITY_STYLE_AUTHENTICATION_BROKEN"; | |
350 break; | |
351 case SECURITY_STYLE_AUTHENTICATED: | |
352 control = "SECURITY_STYLE_AUTHENTICATED"; | |
353 break; | |
354 default: | |
355 control = "UNKNOWN"; | |
356 break; | |
357 } | |
358 | |
359 LogParam(control, l); | |
360 } | |
361 | |
362 // static | |
363 void ParamTraits<PageType>::Write(Message* m, const param_type& p) { | |
364 m->WriteInt(p); | |
365 } | |
366 | |
367 // static | |
368 bool ParamTraits<PageType>::Read(const Message* m, void** iter, param_type* p) { | |
369 int type; | |
370 if (!m->ReadInt(iter, &type)) | |
371 return false; | |
372 *p = static_cast<PageType>(type); | |
373 return true; | |
374 } | |
375 | |
376 // static | |
377 void ParamTraits<PageType>::Log(const param_type& p, std::string* l) { | |
378 std::string control; | |
379 switch (p) { | |
380 case NORMAL_PAGE: | |
381 control = "NORMAL_PAGE"; | |
382 break; | |
383 case ERROR_PAGE: | |
384 control = "ERROR_PAGE"; | |
385 break; | |
386 case INTERSTITIAL_PAGE: | |
387 control = "INTERSTITIAL_PAGE"; | |
388 break; | |
389 default: | |
390 control = "UNKNOWN"; | |
391 break; | |
392 } | |
393 | |
394 LogParam(control, l); | |
395 } | |
396 | |
397 // static | |
398 void ParamTraits<AutomationURLRequest>::Write(Message* m, const param_type& p) { | |
399 WriteParam(m, p.url); | |
400 WriteParam(m, p.method); | |
401 WriteParam(m, p.referrer); | |
402 WriteParam(m, p.extra_request_headers); | |
403 WriteParam(m, p.upload_data); | |
404 WriteParam(m, p.resource_type); | |
405 WriteParam(m, p.load_flags); | |
406 } | |
407 | |
408 // static | |
409 bool ParamTraits<AutomationURLRequest>::Read(const Message* m, | |
410 void** iter, | |
411 param_type* p) { | |
412 return ReadParam(m, iter, &p->url) && | |
413 ReadParam(m, iter, &p->method) && | |
414 ReadParam(m, iter, &p->referrer) && | |
415 ReadParam(m, iter, &p->extra_request_headers) && | |
416 ReadParam(m, iter, &p->upload_data) && | |
417 ReadParam(m, iter, &p->resource_type) && | |
418 ReadParam(m, iter, &p->load_flags); | |
419 } | |
420 | |
421 // static | |
422 void ParamTraits<AutomationURLRequest>::Log(const param_type& p, | |
423 std::string* l) { | |
424 l->append("("); | |
425 LogParam(p.url, l); | |
426 l->append(", "); | |
427 LogParam(p.method, l); | |
428 l->append(", "); | |
429 LogParam(p.referrer, l); | |
430 l->append(", "); | |
431 LogParam(p.extra_request_headers, l); | |
432 l->append(", "); | |
433 LogParam(p.upload_data, l); | |
434 l->append(", "); | |
435 LogParam(p.resource_type, l); | |
436 l->append(", "); | |
437 LogParam(p.load_flags, l); | |
438 l->append(")"); | |
439 } | |
440 | |
441 // static | |
442 void ParamTraits<AutomationURLResponse>::Write(Message* m, | |
443 const param_type& p) { | |
444 WriteParam(m, p.mime_type); | |
445 WriteParam(m, p.headers); | |
446 WriteParam(m, p.content_length); | |
447 WriteParam(m, p.last_modified); | |
448 WriteParam(m, p.redirect_url); | |
449 WriteParam(m, p.redirect_status); | |
450 WriteParam(m, p.socket_address); | |
451 } | |
452 | |
453 // static | |
454 bool ParamTraits<AutomationURLResponse>::Read(const Message* m, | |
455 void** iter, | |
456 param_type* p) { | |
457 return ReadParam(m, iter, &p->mime_type) && | |
458 ReadParam(m, iter, &p->headers) && | |
459 ReadParam(m, iter, &p->content_length) && | |
460 ReadParam(m, iter, &p->last_modified) && | |
461 ReadParam(m, iter, &p->redirect_url) && | |
462 ReadParam(m, iter, &p->redirect_status) && | |
463 ReadParam(m, iter, &p->socket_address); | |
464 } | |
465 | |
466 // static | |
467 void ParamTraits<AutomationURLResponse>::Log(const param_type& p, | |
468 std::string* l) { | |
469 l->append("("); | |
470 LogParam(p.mime_type, l); | |
471 l->append(", "); | |
472 LogParam(p.headers, l); | |
473 l->append(", "); | |
474 LogParam(p.content_length, l); | |
475 l->append(", "); | |
476 LogParam(p.last_modified, l); | |
477 l->append(", "); | |
478 LogParam(p.redirect_url, l); | |
479 l->append(", "); | |
480 LogParam(p.redirect_status, l); | |
481 l->append(", "); | |
482 LogParam(p.socket_address, l); | |
483 l->append(")"); | |
484 } | |
485 | |
486 // static | |
487 void ParamTraits<ExternalTabSettings>::Write(Message* m, | |
488 const param_type& p) { | |
489 WriteParam(m, p.parent); | |
490 WriteParam(m, p.dimensions); | |
491 WriteParam(m, p.style); | |
492 WriteParam(m, p.is_incognito); | |
493 WriteParam(m, p.load_requests_via_automation); | |
494 WriteParam(m, p.handle_top_level_requests); | |
495 WriteParam(m, p.initial_url); | |
496 WriteParam(m, p.referrer); | |
497 WriteParam(m, p.infobars_enabled); | |
498 WriteParam(m, p.route_all_top_level_navigations); | |
499 } | |
500 | |
501 // static | |
502 bool ParamTraits<ExternalTabSettings>::Read(const Message* m, | |
503 void** iter, | |
504 param_type* p) { | |
505 return ReadParam(m, iter, &p->parent) && | |
506 ReadParam(m, iter, &p->dimensions) && | |
507 ReadParam(m, iter, &p->style) && | |
508 ReadParam(m, iter, &p->is_incognito) && | |
509 ReadParam(m, iter, &p->load_requests_via_automation) && | |
510 ReadParam(m, iter, &p->handle_top_level_requests) && | |
511 ReadParam(m, iter, &p->initial_url) && | |
512 ReadParam(m, iter, &p->referrer) && | |
513 ReadParam(m, iter, &p->infobars_enabled) && | |
514 ReadParam(m, iter, &p->route_all_top_level_navigations); | |
515 } | |
516 | |
517 // static | |
518 void ParamTraits<ExternalTabSettings>::Log(const param_type& p, | |
519 std::string* l) { | |
520 l->append("("); | |
521 LogParam(p.parent, l); | |
522 l->append(", "); | |
523 LogParam(p.dimensions, l); | |
524 l->append(", "); | |
525 LogParam(p.style, l); | |
526 l->append(", "); | |
527 LogParam(p.is_incognito, l); | |
528 l->append(", "); | |
529 LogParam(p.load_requests_via_automation, l); | |
530 l->append(", "); | |
531 LogParam(p.handle_top_level_requests, l); | |
532 l->append(", "); | |
533 LogParam(p.initial_url, l); | |
534 l->append(", "); | |
535 LogParam(p.referrer, l); | |
536 l->append(", "); | |
537 LogParam(p.infobars_enabled, l); | |
538 l->append(", "); | |
539 LogParam(p.route_all_top_level_navigations, l); | |
540 l->append(")"); | |
541 } | |
542 | |
543 // static | |
544 void ParamTraits<NavigationInfo>::Write(Message* m, const param_type& p) { | |
545 WriteParam(m, p.navigation_type); | |
546 WriteParam(m, p.relative_offset); | |
547 WriteParam(m, p.navigation_index); | |
548 WriteParam(m, p.title); | |
549 WriteParam(m, p.url); | |
550 WriteParam(m, p.referrer); | |
551 WriteParam(m, p.security_style); | |
552 WriteParam(m, p.displayed_insecure_content); | |
553 WriteParam(m, p.ran_insecure_content); | |
554 } | |
555 | |
556 // static | |
557 bool ParamTraits<NavigationInfo>::Read(const Message* m, | |
558 void** iter, | |
559 param_type* p) { | |
560 return ReadParam(m, iter, &p->navigation_type) && | |
561 ReadParam(m, iter, &p->relative_offset) && | |
562 ReadParam(m, iter, &p->navigation_index) && | |
563 ReadParam(m, iter, &p->title) && | |
564 ReadParam(m, iter, &p->url) && | |
565 ReadParam(m, iter, &p->referrer) && | |
566 ReadParam(m, iter, &p->security_style) && | |
567 ReadParam(m, iter, &p->displayed_insecure_content) && | |
568 ReadParam(m, iter, &p->ran_insecure_content); | |
569 } | |
570 | |
571 // static | |
572 void ParamTraits<NavigationInfo>::Log(const param_type& p, std::string* l) { | |
573 l->append("("); | |
574 LogParam(p.navigation_type, l); | |
575 l->append(", "); | |
576 LogParam(p.relative_offset, l); | |
577 l->append(", "); | |
578 LogParam(p.navigation_index, l); | |
579 l->append(", "); | |
580 LogParam(p.title, l); | |
581 l->append(", "); | |
582 LogParam(p.url, l); | |
583 l->append(", "); | |
584 LogParam(p.referrer, l); | |
585 l->append(", "); | |
586 LogParam(p.security_style, l); | |
587 l->append(", "); | |
588 LogParam(p.displayed_insecure_content, l); | |
589 l->append(", "); | |
590 LogParam(p.ran_insecure_content, l); | |
591 l->append(")"); | |
592 } | |
593 | |
594 // static | |
595 void ParamTraits<MiniContextMenuParams>::Write(Message* m, | |
596 const param_type& p) { | |
597 WriteParam(m, p.screen_x); | |
598 WriteParam(m, p.screen_y); | |
599 WriteParam(m, p.link_url); | |
600 WriteParam(m, p.unfiltered_link_url); | |
601 WriteParam(m, p.src_url); | |
602 WriteParam(m, p.page_url); | |
603 WriteParam(m, p.frame_url); | |
604 } | |
605 | |
606 // static | |
607 bool ParamTraits<MiniContextMenuParams>::Read(const Message* m, | |
608 void** iter, | |
609 param_type* p) { | |
610 return ReadParam(m, iter, &p->screen_x) && | |
611 ReadParam(m, iter, &p->screen_y) && | |
612 ReadParam(m, iter, &p->link_url) && | |
613 ReadParam(m, iter, &p->unfiltered_link_url) && | |
614 ReadParam(m, iter, &p->src_url) && | |
615 ReadParam(m, iter, &p->page_url) && | |
616 ReadParam(m, iter, &p->frame_url); | |
617 } | |
618 | |
619 // static | |
620 void ParamTraits<MiniContextMenuParams>::Log(const param_type& p, | |
621 std::string* l) { | |
622 l->append("("); | |
623 LogParam(p.screen_x, l); | |
624 l->append(", "); | |
625 LogParam(p.screen_y, l); | |
626 l->append(", "); | |
627 LogParam(p.link_url, l); | |
628 l->append(", "); | |
629 LogParam(p.unfiltered_link_url, l); | |
630 l->append(", "); | |
631 LogParam(p.src_url, l); | |
632 l->append(", "); | |
633 LogParam(p.page_url, l); | |
634 l->append(", "); | |
635 LogParam(p.frame_url, l); | |
636 l->append(")"); | |
637 } | |
638 | |
639 // static | |
640 void ParamTraits<AttachExternalTabParams>::Write(Message* m, | |
641 const param_type& p) { | |
642 WriteParam(m, p.cookie); | |
643 WriteParam(m, p.url); | |
644 WriteParam(m, p.dimensions); | |
645 WriteParam(m, p.disposition); | |
646 WriteParam(m, p.user_gesture); | |
647 WriteParam(m, p.profile_name); | |
648 } | |
649 | |
650 // static | |
651 bool ParamTraits<AttachExternalTabParams>::Read(const Message* m, | |
652 void** iter, | |
653 param_type* p) { | |
654 return ReadParam(m, iter, &p->cookie) && | |
655 ReadParam(m, iter, &p->url) && | |
656 ReadParam(m, iter, &p->dimensions) && | |
657 ReadParam(m, iter, &p->disposition) && | |
658 ReadParam(m, iter, &p->user_gesture) && | |
659 ReadParam(m, iter, &p->profile_name); | |
660 } | |
661 | |
662 // static | |
663 void ParamTraits<AttachExternalTabParams>::Log(const param_type& p, | |
664 std::string* l) { | |
665 l->append("("); | |
666 LogParam(p.cookie, l); | |
667 l->append(", "); | |
668 LogParam(p.url, l); | |
669 l->append(", "); | |
670 LogParam(p.dimensions, l); | |
671 l->append(", "); | |
672 LogParam(p.disposition, l); | |
673 l->append(", "); | |
674 LogParam(p.user_gesture, l); | |
675 l->append(","); | |
676 LogParam(p.profile_name, l); | |
677 l->append(")"); | |
678 } | |
679 | |
680 // The traits for these are defined in render_messages.h | |
681 template <> | |
682 struct ParamTraits<ContentSetting> { | |
683 typedef ContentSetting param_type; | |
684 static void Write(Message* m, const param_type& p); | |
685 static bool Read(const Message* m, void** iter, param_type* p); | |
686 static void Log(const param_type& p, std::string* l); | |
687 }; | |
688 | |
689 template <> | |
690 struct ParamTraits<ContentSettingsType> { | |
691 typedef ContentSettingsType param_type; | |
692 static void Write(Message* m, const param_type& p); | |
693 static bool Read(const Message* m, void** iter, param_type* p); | |
694 static void Log(const param_type& p, std::string* l); | |
695 }; | |
696 | |
697 } // namespace IPC | |
OLD | NEW |