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