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