| OLD | NEW |
| (Empty) |
| 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 #include "webkit/glue/form_data.h" | |
| 8 #include "webkit/glue/form_field.h" | |
| 9 #include "webkit/glue/password_form.h" | |
| 10 #include "webkit/glue/password_form_dom_manager.h" | |
| 11 | |
| 12 #define IPC_MESSAGE_IMPL | |
| 13 #include "chrome/common/autofill_messages.h" | |
| 14 | |
| 15 namespace IPC { | |
| 16 | |
| 17 void ParamTraits<webkit_glue::FormField>::Write(Message* m, | |
| 18 const param_type& p) { | |
| 19 WriteParam(m, p.label()); | |
| 20 WriteParam(m, p.name()); | |
| 21 WriteParam(m, p.value()); | |
| 22 WriteParam(m, p.form_control_type()); | |
| 23 WriteParam(m, p.max_length()); | |
| 24 WriteParam(m, p.is_autofilled()); | |
| 25 WriteParam(m, p.option_strings()); | |
| 26 } | |
| 27 | |
| 28 bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, | |
| 29 param_type* p) { | |
| 30 string16 label, name, value, form_control_type; | |
| 31 int max_length = 0; | |
| 32 bool is_autofilled; | |
| 33 std::vector<string16> options; | |
| 34 bool result = ReadParam(m, iter, &label); | |
| 35 result = result && ReadParam(m, iter, &name); | |
| 36 result = result && ReadParam(m, iter, &value); | |
| 37 result = result && ReadParam(m, iter, &form_control_type); | |
| 38 result = result && ReadParam(m, iter, &max_length); | |
| 39 result = result && ReadParam(m, iter, &is_autofilled); | |
| 40 result = result && ReadParam(m, iter, &options); | |
| 41 if (!result) | |
| 42 return false; | |
| 43 | |
| 44 p->set_label(label); | |
| 45 p->set_name(name); | |
| 46 p->set_value(value); | |
| 47 p->set_form_control_type(form_control_type); | |
| 48 p->set_max_length(max_length); | |
| 49 p->set_autofilled(is_autofilled); | |
| 50 p->set_option_strings(options); | |
| 51 return true; | |
| 52 } | |
| 53 | |
| 54 void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, | |
| 55 std::string* l) { | |
| 56 l->append("<FormField>"); | |
| 57 } | |
| 58 | |
| 59 void ParamTraits<webkit_glue::FormData>::Write(Message* m, | |
| 60 const param_type& p) { | |
| 61 WriteParam(m, p.name); | |
| 62 WriteParam(m, p.method); | |
| 63 WriteParam(m, p.origin); | |
| 64 WriteParam(m, p.action); | |
| 65 WriteParam(m, p.user_submitted); | |
| 66 WriteParam(m, p.fields); | |
| 67 } | |
| 68 | |
| 69 bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, | |
| 70 param_type* p) { | |
| 71 return | |
| 72 ReadParam(m, iter, &p->name) && | |
| 73 ReadParam(m, iter, &p->method) && | |
| 74 ReadParam(m, iter, &p->origin) && | |
| 75 ReadParam(m, iter, &p->action) && | |
| 76 ReadParam(m, iter, &p->user_submitted) && | |
| 77 ReadParam(m, iter, &p->fields); | |
| 78 } | |
| 79 | |
| 80 void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, | |
| 81 std::string* l) { | |
| 82 l->append("<FormData>"); | |
| 83 } | |
| 84 | |
| 85 void ParamTraits<webkit_glue::PasswordFormFillData>::Write( | |
| 86 Message* m, const param_type& p) { | |
| 87 WriteParam(m, p.basic_data); | |
| 88 WriteParam(m, p.additional_logins); | |
| 89 WriteParam(m, p.wait_for_username); | |
| 90 } | |
| 91 | |
| 92 bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( | |
| 93 const Message* m, void** iter, param_type* r) { | |
| 94 return | |
| 95 ReadParam(m, iter, &r->basic_data) && | |
| 96 ReadParam(m, iter, &r->additional_logins) && | |
| 97 ReadParam(m, iter, &r->wait_for_username); | |
| 98 } | |
| 99 | |
| 100 void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, | |
| 101 std::string* l) { | |
| 102 l->append("<PasswordFormFillData>"); | |
| 103 } | |
| 104 | |
| 105 } // namespace IPC | |
| OLD | NEW |