| 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 // Get basic type definitions. | 5 // Get basic type definitions. |
| 6 #define IPC_MESSAGE_IMPL | 6 #define IPC_MESSAGE_IMPL |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/common/common_param_traits.h" | 8 #include "chrome/common/common_param_traits.h" |
| 9 | 9 |
| 10 // Generate constructors. | 10 // Generate constructors. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } // namespace IPC | 28 } // namespace IPC |
| 29 | 29 |
| 30 // Generate param traits log methods. | 30 // Generate param traits log methods. |
| 31 #include "ipc/param_traits_log_macros.h" | 31 #include "ipc/param_traits_log_macros.h" |
| 32 namespace IPC { | 32 namespace IPC { |
| 33 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
| 34 } // namespace IPC | 34 } // namespace IPC |
| 35 | 35 |
| 36 namespace IPC { | 36 namespace IPC { |
| 37 | 37 |
| 38 #if defined(OS_MACOSX) | |
| 39 void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { | |
| 40 WriteParam(m, p.font_name); | |
| 41 WriteParam(m, p.font_point_size); | |
| 42 } | |
| 43 | |
| 44 bool ParamTraits<FontDescriptor>::Read(const Message* m, | |
| 45 void** iter, | |
| 46 param_type* p) { | |
| 47 return | |
| 48 ReadParam(m, iter, &p->font_name) && | |
| 49 ReadParam(m, iter, &p->font_point_size); | |
| 50 } | |
| 51 | |
| 52 void ParamTraits<FontDescriptor>::Log(const param_type& p, std::string* l) { | |
| 53 l->append("<FontDescriptor>"); | |
| 54 } | |
| 55 #endif | |
| 56 | |
| 57 void ParamTraits<webkit::npapi::WebPluginGeometry>::Write(Message* m, | |
| 58 const param_type& p) { | |
| 59 WriteParam(m, p.window); | |
| 60 WriteParam(m, p.window_rect); | |
| 61 WriteParam(m, p.clip_rect); | |
| 62 WriteParam(m, p.cutout_rects); | |
| 63 WriteParam(m, p.rects_valid); | |
| 64 WriteParam(m, p.visible); | |
| 65 } | |
| 66 | |
| 67 bool ParamTraits<webkit::npapi::WebPluginGeometry>::Read( | |
| 68 const Message* m, void** iter, param_type* p) { | |
| 69 return | |
| 70 ReadParam(m, iter, &p->window) && | |
| 71 ReadParam(m, iter, &p->window_rect) && | |
| 72 ReadParam(m, iter, &p->clip_rect) && | |
| 73 ReadParam(m, iter, &p->cutout_rects) && | |
| 74 ReadParam(m, iter, &p->rects_valid) && | |
| 75 ReadParam(m, iter, &p->visible); | |
| 76 } | |
| 77 | |
| 78 void ParamTraits<webkit::npapi::WebPluginGeometry>::Log(const param_type& p, | |
| 79 std::string* l) { | |
| 80 l->append("("); | |
| 81 LogParam(p.window, l); | |
| 82 l->append(", "); | |
| 83 LogParam(p.window_rect, l); | |
| 84 l->append(", "); | |
| 85 LogParam(p.clip_rect, l); | |
| 86 l->append(", "); | |
| 87 LogParam(p.cutout_rects, l); | |
| 88 l->append(", "); | |
| 89 LogParam(p.rects_valid, l); | |
| 90 l->append(", "); | |
| 91 LogParam(p.visible, l); | |
| 92 l->append(")"); | |
| 93 } | |
| 94 | |
| 95 void ParamTraits<webkit::npapi::WebPluginMimeType>::Write(Message* m, | |
| 96 const param_type& p) { | |
| 97 WriteParam(m, p.mime_type); | |
| 98 WriteParam(m, p.file_extensions); | |
| 99 WriteParam(m, p.description); | |
| 100 } | |
| 101 | |
| 102 bool ParamTraits<webkit::npapi::WebPluginMimeType>::Read(const Message* m, | |
| 103 void** iter, | |
| 104 param_type* r) { | |
| 105 return | |
| 106 ReadParam(m, iter, &r->mime_type) && | |
| 107 ReadParam(m, iter, &r->file_extensions) && | |
| 108 ReadParam(m, iter, &r->description); | |
| 109 } | |
| 110 | |
| 111 void ParamTraits<webkit::npapi::WebPluginMimeType>::Log(const param_type& p, | |
| 112 std::string* l) { | |
| 113 l->append("("); | |
| 114 LogParam(p.mime_type, l); | |
| 115 l->append(", "); | |
| 116 LogParam(p.file_extensions, l); | |
| 117 l->append(", "); | |
| 118 LogParam(p.description, l); | |
| 119 l->append(")"); | |
| 120 } | |
| 121 | |
| 122 void ParamTraits<webkit::npapi::WebPluginInfo>::Write(Message* m, | |
| 123 const param_type& p) { | |
| 124 WriteParam(m, p.name); | |
| 125 WriteParam(m, p.path); | |
| 126 WriteParam(m, p.version); | |
| 127 WriteParam(m, p.desc); | |
| 128 WriteParam(m, p.mime_types); | |
| 129 WriteParam(m, p.enabled); | |
| 130 } | |
| 131 | |
| 132 bool ParamTraits<webkit::npapi::WebPluginInfo>::Read(const Message* m, | |
| 133 void** iter, | |
| 134 param_type* r) { | |
| 135 return | |
| 136 ReadParam(m, iter, &r->name) && | |
| 137 ReadParam(m, iter, &r->path) && | |
| 138 ReadParam(m, iter, &r->version) && | |
| 139 ReadParam(m, iter, &r->desc) && | |
| 140 ReadParam(m, iter, &r->mime_types) && | |
| 141 ReadParam(m, iter, &r->enabled); | |
| 142 } | |
| 143 | |
| 144 void ParamTraits<webkit::npapi::WebPluginInfo>::Log(const param_type& p, | |
| 145 std::string* l) { | |
| 146 l->append("("); | |
| 147 LogParam(p.name, l); | |
| 148 l->append(", "); | |
| 149 l->append(", "); | |
| 150 LogParam(p.path, l); | |
| 151 l->append(", "); | |
| 152 LogParam(p.version, l); | |
| 153 l->append(", "); | |
| 154 LogParam(p.desc, l); | |
| 155 l->append(", "); | |
| 156 LogParam(p.mime_types, l); | |
| 157 l->append(", "); | |
| 158 LogParam(p.enabled, l); | |
| 159 l->append(")"); | |
| 160 } | |
| 161 | |
| 162 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { | 38 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { |
| 163 WriteParam(m, p.valid_schemes()); | 39 WriteParam(m, p.valid_schemes()); |
| 164 WriteParam(m, p.GetAsString()); | 40 WriteParam(m, p.GetAsString()); |
| 165 } | 41 } |
| 166 | 42 |
| 167 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, | 43 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, |
| 168 param_type* p) { | 44 param_type* p) { |
| 169 int valid_schemes; | 45 int valid_schemes; |
| 170 std::string spec; | 46 std::string spec; |
| 171 if (!ReadParam(m, iter, &valid_schemes) || | 47 if (!ReadParam(m, iter, &valid_schemes) || |
| 172 !ReadParam(m, iter, &spec)) | 48 !ReadParam(m, iter, &spec)) |
| 173 return false; | 49 return false; |
| 174 | 50 |
| 175 p->set_valid_schemes(valid_schemes); | 51 p->set_valid_schemes(valid_schemes); |
| 176 return URLPattern::PARSE_SUCCESS == p->Parse(spec, URLPattern::PARSE_LENIENT); | 52 return URLPattern::PARSE_SUCCESS == p->Parse(spec, URLPattern::PARSE_LENIENT); |
| 177 } | 53 } |
| 178 | 54 |
| 179 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { | 55 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { |
| 180 LogParam(p.GetAsString(), l); | 56 LogParam(p.GetAsString(), l); |
| 181 } | 57 } |
| 182 | 58 |
| 183 void ParamTraits<webkit_glue::WebCookie>::Write(Message* m, | |
| 184 const param_type& p) { | |
| 185 WriteParam(m, p.name); | |
| 186 WriteParam(m, p.value); | |
| 187 WriteParam(m, p.domain); | |
| 188 WriteParam(m, p.path); | |
| 189 WriteParam(m, p.expires); | |
| 190 WriteParam(m, p.http_only); | |
| 191 WriteParam(m, p.secure); | |
| 192 WriteParam(m, p.session); | |
| 193 } | |
| 194 | |
| 195 bool ParamTraits<webkit_glue::WebCookie>::Read(const Message* m, void** iter, | |
| 196 param_type* p) { | |
| 197 return | |
| 198 ReadParam(m, iter, &p->name) && | |
| 199 ReadParam(m, iter, &p->value) && | |
| 200 ReadParam(m, iter, &p->domain) && | |
| 201 ReadParam(m, iter, &p->path) && | |
| 202 ReadParam(m, iter, &p->expires) && | |
| 203 ReadParam(m, iter, &p->http_only) && | |
| 204 ReadParam(m, iter, &p->secure) && | |
| 205 ReadParam(m, iter, &p->session); | |
| 206 } | |
| 207 | |
| 208 void ParamTraits<webkit_glue::WebCookie>::Log(const param_type& p, | |
| 209 std::string* l) { | |
| 210 l->append("<WebCookie>"); | |
| 211 } | |
| 212 | |
| 213 void ParamTraits<ExtensionExtent>::Write(Message* m, const param_type& p) { | 59 void ParamTraits<ExtensionExtent>::Write(Message* m, const param_type& p) { |
| 214 WriteParam(m, p.patterns()); | 60 WriteParam(m, p.patterns()); |
| 215 } | 61 } |
| 216 | 62 |
| 217 bool ParamTraits<ExtensionExtent>::Read(const Message* m, void** iter, | 63 bool ParamTraits<ExtensionExtent>::Read(const Message* m, void** iter, |
| 218 param_type* p) { | 64 param_type* p) { |
| 219 std::vector<URLPattern> patterns; | 65 std::vector<URLPattern> patterns; |
| 220 bool success = | 66 bool success = |
| 221 ReadParam(m, iter, &patterns); | 67 ReadParam(m, iter, &patterns); |
| 222 if (!success) | 68 if (!success) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 l->append(", "); | 134 l->append(", "); |
| 289 LogParam(p.children, l); | 135 LogParam(p.children, l); |
| 290 l->append(", "); | 136 l->append(", "); |
| 291 LogParam(p.html_attributes, l); | 137 LogParam(p.html_attributes, l); |
| 292 l->append(", "); | 138 l->append(", "); |
| 293 LogParam(p.indirect_child_ids, l); | 139 LogParam(p.indirect_child_ids, l); |
| 294 l->append(")"); | 140 l->append(")"); |
| 295 } | 141 } |
| 296 | 142 |
| 297 } // namespace IPC | 143 } // namespace IPC |
| OLD | NEW |