OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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/render_messages.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/common/edit_command.h" |
| 9 #include "chrome/common/extensions/extension_extent.h" |
| 10 #include "chrome/common/extensions/url_pattern.h" |
| 11 #include "chrome/common/indexed_db_key.h" |
| 12 #include "chrome/common/serialized_script_value.h" |
| 13 #include "chrome/common/thumbnail_score.h" |
| 14 #include "gfx/rect.h" |
| 15 #include "ipc/ipc_channel_handle.h" |
| 16 #include "net/http/http_response_headers.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" |
| 21 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
| 22 #include "webkit/appcache/appcache_interfaces.h" |
| 23 #include "webkit/glue/context_menu.h" |
| 24 #include "webkit/glue/form_data.h" |
| 25 #include "webkit/glue/form_field.h" |
| 26 #include "webkit/glue/password_form_dom_manager.h" |
| 27 #include "webkit/glue/password_form.h" |
| 28 #include "webkit/glue/webaccessibility.h" |
| 29 #include "webkit/glue/webcookie.h" |
| 30 #include "webkit/glue/webcursor.h" |
| 31 #include "webkit/glue/webdropdata.h" |
| 32 #include "webkit/glue/plugins/webplugin.h" |
| 33 #include "webkit/glue/plugins/webplugininfo.h" |
| 34 #include "webkit/glue/dom_operations.h" |
| 35 |
| 36 #define MESSAGES_INTERNAL_IMPL_FILE \ |
| 37 "chrome/common/render_messages_internal.h" |
| 38 #include "ipc/ipc_message_impl_macros.h" |
| 39 |
| 40 namespace IPC { |
| 41 |
| 42 void ParamTraits<ViewMsg_Navigate_Params>::Write(Message* m, |
| 43 const param_type& p) { |
| 44 WriteParam(m, p.page_id); |
| 45 WriteParam(m, p.pending_history_list_offset); |
| 46 WriteParam(m, p.current_history_list_offset); |
| 47 WriteParam(m, p.current_history_list_length); |
| 48 WriteParam(m, p.url); |
| 49 WriteParam(m, p.referrer); |
| 50 WriteParam(m, p.transition); |
| 51 WriteParam(m, p.state); |
| 52 WriteParam(m, p.navigation_type); |
| 53 WriteParam(m, p.request_time); |
| 54 } |
| 55 |
| 56 bool ParamTraits<ViewMsg_Navigate_Params>::Read(const Message* m, void** iter, |
| 57 param_type* p) { |
| 58 return |
| 59 ReadParam(m, iter, &p->page_id) && |
| 60 ReadParam(m, iter, &p->pending_history_list_offset) && |
| 61 ReadParam(m, iter, &p->current_history_list_offset) && |
| 62 ReadParam(m, iter, &p->current_history_list_length) && |
| 63 ReadParam(m, iter, &p->url) && |
| 64 ReadParam(m, iter, &p->referrer) && |
| 65 ReadParam(m, iter, &p->transition) && |
| 66 ReadParam(m, iter, &p->state) && |
| 67 ReadParam(m, iter, &p->navigation_type) && |
| 68 ReadParam(m, iter, &p->request_time); |
| 69 } |
| 70 |
| 71 void ParamTraits<ViewMsg_Navigate_Params>::Log(const param_type& p, |
| 72 std::wstring* l) { |
| 73 l->append(L"("); |
| 74 LogParam(p.page_id, l); |
| 75 l->append(L", "); |
| 76 LogParam(p.url, l); |
| 77 l->append(L", "); |
| 78 LogParam(p.transition, l); |
| 79 l->append(L", "); |
| 80 LogParam(p.state, l); |
| 81 l->append(L", "); |
| 82 LogParam(p.navigation_type, l); |
| 83 l->append(L", "); |
| 84 LogParam(p.request_time, l); |
| 85 l->append(L")"); |
| 86 } |
| 87 |
| 88 void ParamTraits<webkit_glue::FormField>::Write(Message* m, |
| 89 const param_type& p) { |
| 90 WriteParam(m, p.label()); |
| 91 WriteParam(m, p.name()); |
| 92 WriteParam(m, p.value()); |
| 93 WriteParam(m, p.form_control_type()); |
| 94 WriteParam(m, p.size()); |
| 95 WriteParam(m, p.option_strings()); |
| 96 } |
| 97 |
| 98 bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, |
| 99 param_type* p) { |
| 100 string16 label, name, value, form_control_type; |
| 101 int size = 0; |
| 102 std::vector<string16> options; |
| 103 bool result = ReadParam(m, iter, &label); |
| 104 result = result && ReadParam(m, iter, &name); |
| 105 result = result && ReadParam(m, iter, &value); |
| 106 result = result && ReadParam(m, iter, &form_control_type); |
| 107 result = result && ReadParam(m, iter, &size); |
| 108 result = result && ReadParam(m, iter, &options); |
| 109 if (!result) |
| 110 return false; |
| 111 |
| 112 p->set_label(label); |
| 113 p->set_name(name); |
| 114 p->set_value(value); |
| 115 p->set_form_control_type(form_control_type); |
| 116 p->set_size(size); |
| 117 p->set_option_strings(options); |
| 118 return true; |
| 119 } |
| 120 |
| 121 void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, |
| 122 std::wstring* l) { |
| 123 l->append(L"<FormField>"); |
| 124 } |
| 125 |
| 126 void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { |
| 127 WriteParam(m, p.media_type); |
| 128 WriteParam(m, p.x); |
| 129 WriteParam(m, p.y); |
| 130 WriteParam(m, p.link_url); |
| 131 WriteParam(m, p.unfiltered_link_url); |
| 132 WriteParam(m, p.src_url); |
| 133 WriteParam(m, p.is_image_blocked); |
| 134 WriteParam(m, p.page_url); |
| 135 WriteParam(m, p.frame_url); |
| 136 WriteParam(m, p.media_flags); |
| 137 WriteParam(m, p.selection_text); |
| 138 WriteParam(m, p.misspelled_word); |
| 139 WriteParam(m, p.dictionary_suggestions); |
| 140 WriteParam(m, p.spellcheck_enabled); |
| 141 WriteParam(m, p.is_editable); |
| 142 #if defined(OS_MACOSX) |
| 143 WriteParam(m, p.writing_direction_default); |
| 144 WriteParam(m, p.writing_direction_left_to_right); |
| 145 WriteParam(m, p.writing_direction_right_to_left); |
| 146 #endif // OS_MACOSX |
| 147 WriteParam(m, p.edit_flags); |
| 148 WriteParam(m, p.security_info); |
| 149 WriteParam(m, p.frame_charset); |
| 150 WriteParam(m, p.custom_items); |
| 151 } |
| 152 |
| 153 bool ParamTraits<ContextMenuParams>::Read(const Message* m, void** iter, |
| 154 param_type* p) { |
| 155 return |
| 156 ReadParam(m, iter, &p->media_type) && |
| 157 ReadParam(m, iter, &p->x) && |
| 158 ReadParam(m, iter, &p->y) && |
| 159 ReadParam(m, iter, &p->link_url) && |
| 160 ReadParam(m, iter, &p->unfiltered_link_url) && |
| 161 ReadParam(m, iter, &p->src_url) && |
| 162 ReadParam(m, iter, &p->is_image_blocked) && |
| 163 ReadParam(m, iter, &p->page_url) && |
| 164 ReadParam(m, iter, &p->frame_url) && |
| 165 ReadParam(m, iter, &p->media_flags) && |
| 166 ReadParam(m, iter, &p->selection_text) && |
| 167 ReadParam(m, iter, &p->misspelled_word) && |
| 168 ReadParam(m, iter, &p->dictionary_suggestions) && |
| 169 ReadParam(m, iter, &p->spellcheck_enabled) && |
| 170 ReadParam(m, iter, &p->is_editable) && |
| 171 #if defined(OS_MACOSX) |
| 172 ReadParam(m, iter, &p->writing_direction_default) && |
| 173 ReadParam(m, iter, &p->writing_direction_left_to_right) && |
| 174 ReadParam(m, iter, &p->writing_direction_right_to_left) && |
| 175 #endif // OS_MACOSX |
| 176 ReadParam(m, iter, &p->edit_flags) && |
| 177 ReadParam(m, iter, &p->security_info) && |
| 178 ReadParam(m, iter, &p->frame_charset) && |
| 179 ReadParam(m, iter, &p->custom_items); |
| 180 } |
| 181 |
| 182 void ParamTraits<ContextMenuParams>::Log(const param_type& p, |
| 183 std::wstring* l) { |
| 184 l->append(L"<ContextMenuParams>"); |
| 185 } |
| 186 |
| 187 void ParamTraits<ViewHostMsg_UpdateRect_Params>::Write( |
| 188 Message* m, const param_type& p) { |
| 189 WriteParam(m, p.bitmap); |
| 190 WriteParam(m, p.bitmap_rect); |
| 191 WriteParam(m, p.dx); |
| 192 WriteParam(m, p.dy); |
| 193 WriteParam(m, p.scroll_rect); |
| 194 WriteParam(m, p.copy_rects); |
| 195 WriteParam(m, p.view_size); |
| 196 WriteParam(m, p.plugin_window_moves); |
| 197 WriteParam(m, p.flags); |
| 198 } |
| 199 |
| 200 bool ParamTraits<ViewHostMsg_UpdateRect_Params>::Read( |
| 201 const Message* m, void** iter, param_type* p) { |
| 202 return |
| 203 ReadParam(m, iter, &p->bitmap) && |
| 204 ReadParam(m, iter, &p->bitmap_rect) && |
| 205 ReadParam(m, iter, &p->dx) && |
| 206 ReadParam(m, iter, &p->dy) && |
| 207 ReadParam(m, iter, &p->scroll_rect) && |
| 208 ReadParam(m, iter, &p->copy_rects) && |
| 209 ReadParam(m, iter, &p->view_size) && |
| 210 ReadParam(m, iter, &p->plugin_window_moves) && |
| 211 ReadParam(m, iter, &p->flags); |
| 212 } |
| 213 |
| 214 void ParamTraits<ViewHostMsg_UpdateRect_Params>::Log(const param_type& p, |
| 215 std::wstring* l) { |
| 216 l->append(L"("); |
| 217 LogParam(p.bitmap, l); |
| 218 l->append(L", "); |
| 219 LogParam(p.bitmap_rect, l); |
| 220 l->append(L", "); |
| 221 LogParam(p.dx, l); |
| 222 l->append(L", "); |
| 223 LogParam(p.dy, l); |
| 224 l->append(L", "); |
| 225 LogParam(p.scroll_rect, l); |
| 226 l->append(L", "); |
| 227 LogParam(p.copy_rects, l); |
| 228 l->append(L", "); |
| 229 LogParam(p.view_size, l); |
| 230 l->append(L", "); |
| 231 LogParam(p.plugin_window_moves, l); |
| 232 l->append(L", "); |
| 233 LogParam(p.flags, l); |
| 234 l->append(L")"); |
| 235 } |
| 236 |
| 237 void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, |
| 238 const param_type& p) { |
| 239 WriteParam(m, p.window); |
| 240 WriteParam(m, p.window_rect); |
| 241 WriteParam(m, p.clip_rect); |
| 242 WriteParam(m, p.cutout_rects); |
| 243 WriteParam(m, p.rects_valid); |
| 244 WriteParam(m, p.visible); |
| 245 } |
| 246 |
| 247 bool ParamTraits<webkit_glue::WebPluginGeometry>::Read( |
| 248 const Message* m, void** iter, param_type* p) { |
| 249 return |
| 250 ReadParam(m, iter, &p->window) && |
| 251 ReadParam(m, iter, &p->window_rect) && |
| 252 ReadParam(m, iter, &p->clip_rect) && |
| 253 ReadParam(m, iter, &p->cutout_rects) && |
| 254 ReadParam(m, iter, &p->rects_valid) && |
| 255 ReadParam(m, iter, &p->visible); |
| 256 } |
| 257 |
| 258 void ParamTraits<webkit_glue::WebPluginGeometry>::Log(const param_type& p, |
| 259 std::wstring* l) { |
| 260 l->append(L"("); |
| 261 LogParam(p.window, l); |
| 262 l->append(L", "); |
| 263 LogParam(p.window_rect, l); |
| 264 l->append(L", "); |
| 265 LogParam(p.clip_rect, l); |
| 266 l->append(L", "); |
| 267 LogParam(p.cutout_rects, l); |
| 268 l->append(L", "); |
| 269 LogParam(p.rects_valid, l); |
| 270 l->append(L", "); |
| 271 LogParam(p.visible, l); |
| 272 l->append(L")"); |
| 273 } |
| 274 |
| 275 void ParamTraits<WebPluginMimeType>::Write(Message* m, const param_type& p) { |
| 276 WriteParam(m, p.mime_type); |
| 277 WriteParam(m, p.file_extensions); |
| 278 WriteParam(m, p.description); |
| 279 } |
| 280 |
| 281 bool ParamTraits<WebPluginMimeType>::Read(const Message* m, void** iter, |
| 282 param_type* r) { |
| 283 return |
| 284 ReadParam(m, iter, &r->mime_type) && |
| 285 ReadParam(m, iter, &r->file_extensions) && |
| 286 ReadParam(m, iter, &r->description); |
| 287 } |
| 288 |
| 289 void ParamTraits<WebPluginMimeType>::Log(const param_type& p, std::wstring* l) { |
| 290 l->append(L"("); |
| 291 LogParam(p.mime_type, l); |
| 292 l->append(L", "); |
| 293 LogParam(p.file_extensions, l); |
| 294 l->append(L", "); |
| 295 LogParam(p.description, l); |
| 296 l->append(L")"); |
| 297 } |
| 298 |
| 299 void ParamTraits<WebPluginInfo>::Write(Message* m, const param_type& p) { |
| 300 WriteParam(m, p.name); |
| 301 WriteParam(m, p.path); |
| 302 WriteParam(m, p.version); |
| 303 WriteParam(m, p.desc); |
| 304 WriteParam(m, p.mime_types); |
| 305 WriteParam(m, p.enabled); |
| 306 } |
| 307 |
| 308 bool ParamTraits<WebPluginInfo>::Read(const Message* m, void** iter, |
| 309 param_type* r) { |
| 310 return |
| 311 ReadParam(m, iter, &r->name) && |
| 312 ReadParam(m, iter, &r->path) && |
| 313 ReadParam(m, iter, &r->version) && |
| 314 ReadParam(m, iter, &r->desc) && |
| 315 ReadParam(m, iter, &r->mime_types) && |
| 316 ReadParam(m, iter, &r->enabled); |
| 317 } |
| 318 |
| 319 void ParamTraits<WebPluginInfo>::Log(const param_type& p, std::wstring* l) { |
| 320 l->append(L"("); |
| 321 LogParam(p.name, l); |
| 322 l->append(L", "); |
| 323 l->append(L", "); |
| 324 LogParam(p.path, l); |
| 325 l->append(L", "); |
| 326 LogParam(p.version, l); |
| 327 l->append(L", "); |
| 328 LogParam(p.desc, l); |
| 329 l->append(L", "); |
| 330 LogParam(p.mime_types, l); |
| 331 l->append(L", "); |
| 332 LogParam(p.enabled, l); |
| 333 l->append(L")"); |
| 334 } |
| 335 |
| 336 void ParamTraits<webkit_glue::PasswordFormFillData>::Write( |
| 337 Message* m, const param_type& p) { |
| 338 WriteParam(m, p.basic_data); |
| 339 WriteParam(m, p.additional_logins); |
| 340 WriteParam(m, p.wait_for_username); |
| 341 } |
| 342 |
| 343 bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( |
| 344 const Message* m, void** iter, param_type* r) { |
| 345 return |
| 346 ReadParam(m, iter, &r->basic_data) && |
| 347 ReadParam(m, iter, &r->additional_logins) && |
| 348 ReadParam(m, iter, &r->wait_for_username); |
| 349 } |
| 350 |
| 351 void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, |
| 352 std::wstring* l) { |
| 353 l->append(L"<PasswordFormFillData>"); |
| 354 } |
| 355 |
| 356 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( |
| 357 Message* m, const param_type& p) { |
| 358 WriteParam(m, p.get() != NULL); |
| 359 if (p) { |
| 360 // Do not disclose Set-Cookie headers over IPC. |
| 361 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); |
| 362 } |
| 363 } |
| 364 |
| 365 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( |
| 366 const Message* m, void** iter, param_type* r) { |
| 367 bool has_object; |
| 368 if (!ReadParam(m, iter, &has_object)) |
| 369 return false; |
| 370 if (has_object) |
| 371 *r = new net::HttpResponseHeaders(*m, iter); |
| 372 return true; |
| 373 } |
| 374 |
| 375 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( |
| 376 const param_type& p, std::wstring* l) { |
| 377 l->append(L"<HttpResponseHeaders>"); |
| 378 } |
| 379 |
| 380 void ParamTraits<SerializedScriptValue>::Write(Message* m, const param_type& p)
{ |
| 381 WriteParam(m, p.is_null()); |
| 382 WriteParam(m, p.is_invalid()); |
| 383 WriteParam(m, p.data()); |
| 384 } |
| 385 |
| 386 bool ParamTraits<SerializedScriptValue>::Read(const Message* m, void** iter, |
| 387 param_type* r) { |
| 388 bool is_null; |
| 389 bool is_invalid; |
| 390 string16 data; |
| 391 bool ok = |
| 392 ReadParam(m, iter, &is_null) && |
| 393 ReadParam(m, iter, &is_invalid) && |
| 394 ReadParam(m, iter, &data); |
| 395 if (!ok) |
| 396 return false; |
| 397 r->set_is_null(is_null); |
| 398 r->set_is_invalid(is_invalid); |
| 399 r->set_data(data); |
| 400 return true; |
| 401 } |
| 402 |
| 403 void ParamTraits<SerializedScriptValue>::Log(const param_type& p, |
| 404 std::wstring* l) { |
| 405 l->append(L"<SerializedScriptValue>("); |
| 406 LogParam(p.is_null(), l); |
| 407 l->append(L", "); |
| 408 LogParam(p.is_invalid(), l); |
| 409 l->append(L", "); |
| 410 LogParam(p.data(), l); |
| 411 l->append(L")"); |
| 412 } |
| 413 |
| 414 void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) { |
| 415 WriteParam(m, int(p.type())); |
| 416 // TODO(jorlow): Technically, we only need to pack the type being used. |
| 417 WriteParam(m, p.string()); |
| 418 WriteParam(m, p.number()); |
| 419 } |
| 420 |
| 421 bool ParamTraits<IndexedDBKey>::Read(const Message* m, void** iter, |
| 422 param_type* r) { |
| 423 int type; |
| 424 string16 string; |
| 425 int32 number; |
| 426 bool ok = |
| 427 ReadParam(m, iter, &type) && |
| 428 ReadParam(m, iter, &string) && |
| 429 ReadParam(m, iter, &number); |
| 430 if (!ok) |
| 431 return false; |
| 432 switch (type) { |
| 433 case WebKit::WebIDBKey::NullType: |
| 434 r->SetNull(); |
| 435 return true; |
| 436 case WebKit::WebIDBKey::StringType: |
| 437 r->Set(string); |
| 438 return true; |
| 439 case WebKit::WebIDBKey::NumberType: |
| 440 r->Set(number); |
| 441 return true; |
| 442 case WebKit::WebIDBKey::InvalidType: |
| 443 r->SetInvalid(); |
| 444 return true; |
| 445 } |
| 446 NOTREACHED(); |
| 447 return false; |
| 448 } |
| 449 |
| 450 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::wstring* l) { |
| 451 l->append(L"<IndexedDBKey>("); |
| 452 LogParam(int(p.type()), l); |
| 453 l->append(L", "); |
| 454 LogParam(p.string(), l); |
| 455 l->append(L", "); |
| 456 LogParam(p.number(), l); |
| 457 l->append(L")"); |
| 458 } |
| 459 |
| 460 void ParamTraits<webkit_glue::FormData>::Write(Message* m, |
| 461 const param_type& p) { |
| 462 WriteParam(m, p.name); |
| 463 WriteParam(m, p.method); |
| 464 WriteParam(m, p.origin); |
| 465 WriteParam(m, p.action); |
| 466 WriteParam(m, p.user_submitted); |
| 467 WriteParam(m, p.fields); |
| 468 } |
| 469 |
| 470 bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, |
| 471 param_type* p) { |
| 472 return |
| 473 ReadParam(m, iter, &p->name) && |
| 474 ReadParam(m, iter, &p->method) && |
| 475 ReadParam(m, iter, &p->origin) && |
| 476 ReadParam(m, iter, &p->action) && |
| 477 ReadParam(m, iter, &p->user_submitted) && |
| 478 ReadParam(m, iter, &p->fields); |
| 479 } |
| 480 |
| 481 void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, |
| 482 std::wstring* l) { |
| 483 l->append(L"<FormData>"); |
| 484 } |
| 485 |
| 486 void ParamTraits<RendererPreferences>::Write(Message* m, const param_type& p) { |
| 487 WriteParam(m, p.can_accept_load_drops); |
| 488 WriteParam(m, p.should_antialias_text); |
| 489 WriteParam(m, static_cast<int>(p.hinting)); |
| 490 WriteParam(m, static_cast<int>(p.subpixel_rendering)); |
| 491 WriteParam(m, p.focus_ring_color); |
| 492 WriteParam(m, p.thumb_active_color); |
| 493 WriteParam(m, p.thumb_inactive_color); |
| 494 WriteParam(m, p.track_color); |
| 495 WriteParam(m, p.active_selection_bg_color); |
| 496 WriteParam(m, p.active_selection_fg_color); |
| 497 WriteParam(m, p.inactive_selection_bg_color); |
| 498 WriteParam(m, p.inactive_selection_fg_color); |
| 499 WriteParam(m, p.browser_handles_top_level_requests); |
| 500 WriteParam(m, p.caret_blink_interval); |
| 501 } |
| 502 |
| 503 bool ParamTraits<RendererPreferences>::Read(const Message* m, void** iter, |
| 504 param_type* p) { |
| 505 if (!ReadParam(m, iter, &p->can_accept_load_drops)) |
| 506 return false; |
| 507 if (!ReadParam(m, iter, &p->should_antialias_text)) |
| 508 return false; |
| 509 |
| 510 int hinting = 0; |
| 511 if (!ReadParam(m, iter, &hinting)) |
| 512 return false; |
| 513 p->hinting = static_cast<RendererPreferencesHintingEnum>(hinting); |
| 514 |
| 515 int subpixel_rendering = 0; |
| 516 if (!ReadParam(m, iter, &subpixel_rendering)) |
| 517 return false; |
| 518 p->subpixel_rendering = |
| 519 static_cast<RendererPreferencesSubpixelRenderingEnum>( |
| 520 subpixel_rendering); |
| 521 |
| 522 int focus_ring_color; |
| 523 if (!ReadParam(m, iter, &focus_ring_color)) |
| 524 return false; |
| 525 p->focus_ring_color = focus_ring_color; |
| 526 |
| 527 int thumb_active_color, thumb_inactive_color, track_color; |
| 528 int active_selection_bg_color, active_selection_fg_color; |
| 529 int inactive_selection_bg_color, inactive_selection_fg_color; |
| 530 if (!ReadParam(m, iter, &thumb_active_color) || |
| 531 !ReadParam(m, iter, &thumb_inactive_color) || |
| 532 !ReadParam(m, iter, &track_color) || |
| 533 !ReadParam(m, iter, &active_selection_bg_color) || |
| 534 !ReadParam(m, iter, &active_selection_fg_color) || |
| 535 !ReadParam(m, iter, &inactive_selection_bg_color) || |
| 536 !ReadParam(m, iter, &inactive_selection_fg_color)) |
| 537 return false; |
| 538 p->thumb_active_color = thumb_active_color; |
| 539 p->thumb_inactive_color = thumb_inactive_color; |
| 540 p->track_color = track_color; |
| 541 p->active_selection_bg_color = active_selection_bg_color; |
| 542 p->active_selection_fg_color = active_selection_fg_color; |
| 543 p->inactive_selection_bg_color = inactive_selection_bg_color; |
| 544 p->inactive_selection_fg_color = inactive_selection_fg_color; |
| 545 |
| 546 if (!ReadParam(m, iter, &p->browser_handles_top_level_requests)) |
| 547 return false; |
| 548 |
| 549 if (!ReadParam(m, iter, &p->caret_blink_interval)) |
| 550 return false; |
| 551 |
| 552 return true; |
| 553 } |
| 554 |
| 555 void ParamTraits<RendererPreferences>::Log(const param_type& p, |
| 556 std::wstring* l) { |
| 557 l->append(L"<RendererPreferences>"); |
| 558 } |
| 559 |
| 560 void ParamTraits<WebPreferences>::Write(Message* m, const param_type& p) { |
| 561 WriteParam(m, p.standard_font_family); |
| 562 WriteParam(m, p.fixed_font_family); |
| 563 WriteParam(m, p.serif_font_family); |
| 564 WriteParam(m, p.sans_serif_font_family); |
| 565 WriteParam(m, p.cursive_font_family); |
| 566 WriteParam(m, p.fantasy_font_family); |
| 567 WriteParam(m, p.default_font_size); |
| 568 WriteParam(m, p.default_fixed_font_size); |
| 569 WriteParam(m, p.minimum_font_size); |
| 570 WriteParam(m, p.minimum_logical_font_size); |
| 571 WriteParam(m, p.default_encoding); |
| 572 WriteParam(m, p.javascript_enabled); |
| 573 WriteParam(m, p.web_security_enabled); |
| 574 WriteParam(m, p.javascript_can_open_windows_automatically); |
| 575 WriteParam(m, p.loads_images_automatically); |
| 576 WriteParam(m, p.plugins_enabled); |
| 577 WriteParam(m, p.dom_paste_enabled); |
| 578 WriteParam(m, p.developer_extras_enabled); |
| 579 WriteParam(m, p.inspector_settings); |
| 580 WriteParam(m, p.site_specific_quirks_enabled); |
| 581 WriteParam(m, p.shrinks_standalone_images_to_fit); |
| 582 WriteParam(m, p.uses_universal_detector); |
| 583 WriteParam(m, p.text_areas_are_resizable); |
| 584 WriteParam(m, p.java_enabled); |
| 585 WriteParam(m, p.allow_scripts_to_close_windows); |
| 586 WriteParam(m, p.uses_page_cache); |
| 587 WriteParam(m, p.remote_fonts_enabled); |
| 588 WriteParam(m, p.javascript_can_access_clipboard); |
| 589 WriteParam(m, p.xss_auditor_enabled); |
| 590 WriteParam(m, p.local_storage_enabled); |
| 591 WriteParam(m, p.databases_enabled); |
| 592 WriteParam(m, p.application_cache_enabled); |
| 593 WriteParam(m, p.tabs_to_links); |
| 594 WriteParam(m, p.user_style_sheet_enabled); |
| 595 WriteParam(m, p.user_style_sheet_location); |
| 596 WriteParam(m, p.author_and_user_styles_enabled); |
| 597 WriteParam(m, p.allow_universal_access_from_file_urls); |
| 598 WriteParam(m, p.allow_file_access_from_file_urls); |
| 599 WriteParam(m, p.experimental_webgl_enabled); |
| 600 WriteParam(m, p.show_composited_layer_borders); |
| 601 WriteParam(m, p.accelerated_compositing_enabled); |
| 602 WriteParam(m, p.accelerated_2d_canvas_enabled); |
| 603 WriteParam(m, p.memory_info_enabled); |
| 604 } |
| 605 |
| 606 bool ParamTraits<WebPreferences>::Read(const Message* m, void** iter, |
| 607 param_type* p) { |
| 608 return |
| 609 ReadParam(m, iter, &p->standard_font_family) && |
| 610 ReadParam(m, iter, &p->fixed_font_family) && |
| 611 ReadParam(m, iter, &p->serif_font_family) && |
| 612 ReadParam(m, iter, &p->sans_serif_font_family) && |
| 613 ReadParam(m, iter, &p->cursive_font_family) && |
| 614 ReadParam(m, iter, &p->fantasy_font_family) && |
| 615 ReadParam(m, iter, &p->default_font_size) && |
| 616 ReadParam(m, iter, &p->default_fixed_font_size) && |
| 617 ReadParam(m, iter, &p->minimum_font_size) && |
| 618 ReadParam(m, iter, &p->minimum_logical_font_size) && |
| 619 ReadParam(m, iter, &p->default_encoding) && |
| 620 ReadParam(m, iter, &p->javascript_enabled) && |
| 621 ReadParam(m, iter, &p->web_security_enabled) && |
| 622 ReadParam(m, iter, &p->javascript_can_open_windows_automatically) && |
| 623 ReadParam(m, iter, &p->loads_images_automatically) && |
| 624 ReadParam(m, iter, &p->plugins_enabled) && |
| 625 ReadParam(m, iter, &p->dom_paste_enabled) && |
| 626 ReadParam(m, iter, &p->developer_extras_enabled) && |
| 627 ReadParam(m, iter, &p->inspector_settings) && |
| 628 ReadParam(m, iter, &p->site_specific_quirks_enabled) && |
| 629 ReadParam(m, iter, &p->shrinks_standalone_images_to_fit) && |
| 630 ReadParam(m, iter, &p->uses_universal_detector) && |
| 631 ReadParam(m, iter, &p->text_areas_are_resizable) && |
| 632 ReadParam(m, iter, &p->java_enabled) && |
| 633 ReadParam(m, iter, &p->allow_scripts_to_close_windows) && |
| 634 ReadParam(m, iter, &p->uses_page_cache) && |
| 635 ReadParam(m, iter, &p->remote_fonts_enabled) && |
| 636 ReadParam(m, iter, &p->javascript_can_access_clipboard) && |
| 637 ReadParam(m, iter, &p->xss_auditor_enabled) && |
| 638 ReadParam(m, iter, &p->local_storage_enabled) && |
| 639 ReadParam(m, iter, &p->databases_enabled) && |
| 640 ReadParam(m, iter, &p->application_cache_enabled) && |
| 641 ReadParam(m, iter, &p->tabs_to_links) && |
| 642 ReadParam(m, iter, &p->user_style_sheet_enabled) && |
| 643 ReadParam(m, iter, &p->user_style_sheet_location) && |
| 644 ReadParam(m, iter, &p->author_and_user_styles_enabled) && |
| 645 ReadParam(m, iter, &p->allow_universal_access_from_file_urls) && |
| 646 ReadParam(m, iter, &p->allow_file_access_from_file_urls) && |
| 647 ReadParam(m, iter, &p->experimental_webgl_enabled) && |
| 648 ReadParam(m, iter, &p->show_composited_layer_borders) && |
| 649 ReadParam(m, iter, &p->accelerated_compositing_enabled) && |
| 650 ReadParam(m, iter, &p->accelerated_2d_canvas_enabled) && |
| 651 ReadParam(m, iter, &p->memory_info_enabled); |
| 652 } |
| 653 |
| 654 void ParamTraits<WebPreferences>::Log(const param_type& p, std::wstring* l) { |
| 655 l->append(L"<WebPreferences>"); |
| 656 } |
| 657 |
| 658 void ParamTraits<WebDropData>::Write(Message* m, const param_type& p) { |
| 659 WriteParam(m, p.identity); |
| 660 WriteParam(m, p.url); |
| 661 WriteParam(m, p.url_title); |
| 662 WriteParam(m, p.download_metadata); |
| 663 WriteParam(m, p.file_extension); |
| 664 WriteParam(m, p.filenames); |
| 665 WriteParam(m, p.plain_text); |
| 666 WriteParam(m, p.text_html); |
| 667 WriteParam(m, p.html_base_url); |
| 668 WriteParam(m, p.file_description_filename); |
| 669 WriteParam(m, p.file_contents); |
| 670 } |
| 671 |
| 672 bool ParamTraits<WebDropData>::Read(const Message* m, void** iter, |
| 673 param_type* p) { |
| 674 return |
| 675 ReadParam(m, iter, &p->identity) && |
| 676 ReadParam(m, iter, &p->url) && |
| 677 ReadParam(m, iter, &p->url_title) && |
| 678 ReadParam(m, iter, &p->download_metadata) && |
| 679 ReadParam(m, iter, &p->file_extension) && |
| 680 ReadParam(m, iter, &p->filenames) && |
| 681 ReadParam(m, iter, &p->plain_text) && |
| 682 ReadParam(m, iter, &p->text_html) && |
| 683 ReadParam(m, iter, &p->html_base_url) && |
| 684 ReadParam(m, iter, &p->file_description_filename) && |
| 685 ReadParam(m, iter, &p->file_contents); |
| 686 } |
| 687 |
| 688 void ParamTraits<WebDropData>::Log(const param_type& p, std::wstring* l) { |
| 689 l->append(L"<WebDropData>"); |
| 690 } |
| 691 |
| 692 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { |
| 693 WriteParam(m, p.valid_schemes()); |
| 694 WriteParam(m, p.GetAsString()); |
| 695 } |
| 696 |
| 697 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, |
| 698 param_type* p) { |
| 699 int valid_schemes; |
| 700 std::string spec; |
| 701 if (!ReadParam(m, iter, &valid_schemes) || |
| 702 !ReadParam(m, iter, &spec)) |
| 703 return false; |
| 704 |
| 705 p->set_valid_schemes(valid_schemes); |
| 706 return p->Parse(spec); |
| 707 } |
| 708 |
| 709 void ParamTraits<URLPattern>::Log(const param_type& p, std::wstring* l) { |
| 710 LogParam(p.GetAsString(), l); |
| 711 } |
| 712 |
| 713 void ParamTraits<EditCommand>::Write(Message* m, const param_type& p) { |
| 714 WriteParam(m, p.name); |
| 715 WriteParam(m, p.value); |
| 716 } |
| 717 |
| 718 bool ParamTraits<EditCommand>::Read(const Message* m, void** iter, |
| 719 param_type* p) { |
| 720 return ReadParam(m, iter, &p->name) && ReadParam(m, iter, &p->value); |
| 721 } |
| 722 |
| 723 void ParamTraits<EditCommand>::Log(const param_type& p, std::wstring* l) { |
| 724 l->append(L"("); |
| 725 LogParam(p.name, l); |
| 726 l->append(L":"); |
| 727 LogParam(p.value, l); |
| 728 l->append(L")"); |
| 729 } |
| 730 |
| 731 void ParamTraits<webkit_glue::WebCookie>::Write(Message* m, |
| 732 const param_type& p) { |
| 733 WriteParam(m, p.name); |
| 734 WriteParam(m, p.value); |
| 735 WriteParam(m, p.domain); |
| 736 WriteParam(m, p.path); |
| 737 WriteParam(m, p.expires); |
| 738 WriteParam(m, p.http_only); |
| 739 WriteParam(m, p.secure); |
| 740 WriteParam(m, p.session); |
| 741 } |
| 742 |
| 743 bool ParamTraits<webkit_glue::WebCookie>::Read(const Message* m, void** iter, |
| 744 param_type* p) { |
| 745 return |
| 746 ReadParam(m, iter, &p->name) && |
| 747 ReadParam(m, iter, &p->value) && |
| 748 ReadParam(m, iter, &p->domain) && |
| 749 ReadParam(m, iter, &p->path) && |
| 750 ReadParam(m, iter, &p->expires) && |
| 751 ReadParam(m, iter, &p->http_only) && |
| 752 ReadParam(m, iter, &p->secure) && |
| 753 ReadParam(m, iter, &p->session); |
| 754 } |
| 755 |
| 756 void ParamTraits<webkit_glue::WebCookie>::Log(const param_type& p, |
| 757 std::wstring* l) { |
| 758 l->append(L"<WebCookie>"); |
| 759 } |
| 760 |
| 761 void ParamTraits<ExtensionExtent>::Write(Message* m, const param_type& p) { |
| 762 WriteParam(m, p.patterns()); |
| 763 } |
| 764 |
| 765 bool ParamTraits<ExtensionExtent>::Read(const Message* m, void** iter, |
| 766 param_type* p) { |
| 767 std::vector<URLPattern> patterns; |
| 768 bool success = |
| 769 ReadParam(m, iter, &patterns); |
| 770 if (!success) |
| 771 return false; |
| 772 |
| 773 for (size_t i = 0; i < patterns.size(); ++i) |
| 774 p->AddPattern(patterns[i]); |
| 775 return true; |
| 776 } |
| 777 |
| 778 void ParamTraits<ExtensionExtent>::Log(const param_type& p, std::wstring* l) { |
| 779 LogParam(p.patterns(), l); |
| 780 } |
| 781 |
| 782 void ParamTraits<appcache::AppCacheResourceInfo>::Write(Message* m, |
| 783 const param_type& p) { |
| 784 WriteParam(m, p.url); |
| 785 WriteParam(m, p.size); |
| 786 WriteParam(m, p.is_manifest); |
| 787 WriteParam(m, p.is_master); |
| 788 WriteParam(m, p.is_fallback); |
| 789 WriteParam(m, p.is_foreign); |
| 790 WriteParam(m, p.is_explicit); |
| 791 } |
| 792 |
| 793 bool ParamTraits<appcache::AppCacheResourceInfo>::Read( |
| 794 const Message* m, void** iter, param_type* p) { |
| 795 return ReadParam(m, iter, &p->url) && |
| 796 ReadParam(m, iter, &p->size) && |
| 797 ReadParam(m, iter, &p->is_manifest) && |
| 798 ReadParam(m, iter, &p->is_master) && |
| 799 ReadParam(m, iter, &p->is_fallback) && |
| 800 ReadParam(m, iter, &p->is_foreign) && |
| 801 ReadParam(m, iter, &p->is_explicit); |
| 802 } |
| 803 |
| 804 void ParamTraits<appcache::AppCacheResourceInfo>::Log(const param_type& p, |
| 805 std::wstring* l) { |
| 806 l->append(L"("); |
| 807 LogParam(p.url, l); |
| 808 l->append(L", "); |
| 809 LogParam(p.size, l); |
| 810 l->append(L", "); |
| 811 LogParam(p.is_manifest, l); |
| 812 l->append(L", "); |
| 813 LogParam(p.is_master, l); |
| 814 l->append(L", "); |
| 815 LogParam(p.is_fallback, l); |
| 816 l->append(L", "); |
| 817 LogParam(p.is_foreign, l); |
| 818 l->append(L", "); |
| 819 LogParam(p.is_explicit, l); |
| 820 l->append(L")"); |
| 821 } |
| 822 |
| 823 void ParamTraits<appcache::AppCacheInfo>::Write(Message* m, |
| 824 const param_type& p) { |
| 825 WriteParam(m, p.manifest_url); |
| 826 WriteParam(m, p.creation_time); |
| 827 WriteParam(m, p.last_update_time); |
| 828 WriteParam(m, p.last_access_time); |
| 829 WriteParam(m, p.cache_id); |
| 830 WriteParam(m, p.status); |
| 831 WriteParam(m, p.size); |
| 832 WriteParam(m, p.is_complete); |
| 833 } |
| 834 |
| 835 bool ParamTraits<appcache::AppCacheInfo>::Read(const Message* m, void** iter, |
| 836 param_type* p) { |
| 837 return ReadParam(m, iter, &p->manifest_url) && |
| 838 ReadParam(m, iter, &p->creation_time) && |
| 839 ReadParam(m, iter, &p->last_update_time) && |
| 840 ReadParam(m, iter, &p->last_access_time) && |
| 841 ReadParam(m, iter, &p->cache_id) && |
| 842 ReadParam(m, iter, &p->status) && |
| 843 ReadParam(m, iter, &p->size) && |
| 844 ReadParam(m, iter, &p->is_complete); |
| 845 } |
| 846 |
| 847 void ParamTraits<appcache::AppCacheInfo>::Log(const param_type& p, |
| 848 std::wstring* l) { |
| 849 l->append(L"("); |
| 850 LogParam(p.manifest_url, l); |
| 851 l->append(L", "); |
| 852 LogParam(p.creation_time, l); |
| 853 l->append(L", "); |
| 854 LogParam(p.last_update_time, l); |
| 855 l->append(L", "); |
| 856 LogParam(p.last_access_time, l); |
| 857 l->append(L", "); |
| 858 LogParam(p.cache_id, l); |
| 859 l->append(L", "); |
| 860 LogParam(p.status, l); |
| 861 l->append(L", "); |
| 862 LogParam(p.size, l); |
| 863 l->append(L")"); |
| 864 LogParam(p.is_complete, l); |
| 865 l->append(L", "); |
| 866 } |
| 867 |
| 868 void ParamTraits<webkit_glue::WebAccessibility>::Write(Message* m, |
| 869 const param_type& p) { |
| 870 WriteParam(m, p.id); |
| 871 WriteParam(m, p.name); |
| 872 WriteParam(m, p.value); |
| 873 WriteParam(m, static_cast<int>(p.role)); |
| 874 WriteParam(m, static_cast<int>(p.state)); |
| 875 WriteParam(m, p.location); |
| 876 WriteParam(m, p.attributes); |
| 877 WriteParam(m, p.children); |
| 878 } |
| 879 |
| 880 bool ParamTraits<webkit_glue::WebAccessibility>::Read( |
| 881 const Message* m, void** iter, param_type* p) { |
| 882 bool ret = ReadParam(m, iter, &p->id); |
| 883 ret = ret && ReadParam(m, iter, &p->name); |
| 884 ret = ret && ReadParam(m, iter, &p->value); |
| 885 int role = -1; |
| 886 ret = ret && ReadParam(m, iter, &role); |
| 887 if (role >= webkit_glue::WebAccessibility::ROLE_NONE && |
| 888 role < webkit_glue::WebAccessibility::NUM_ROLES) { |
| 889 p->role = static_cast<webkit_glue::WebAccessibility::Role>(role); |
| 890 } else { |
| 891 p->role = webkit_glue::WebAccessibility::ROLE_NONE; |
| 892 } |
| 893 int state = 0; |
| 894 ret = ret && ReadParam(m, iter, &state); |
| 895 p->state = static_cast<webkit_glue::WebAccessibility::State>(state); |
| 896 ret = ret && ReadParam(m, iter, &p->location); |
| 897 ret = ret && ReadParam(m, iter, &p->attributes); |
| 898 ret = ret && ReadParam(m, iter, &p->children); |
| 899 return ret; |
| 900 } |
| 901 |
| 902 void ParamTraits<webkit_glue::WebAccessibility>::Log(const param_type& p, |
| 903 std::wstring* l) { |
| 904 l->append(L"("); |
| 905 LogParam(p.id, l); |
| 906 l->append(L", "); |
| 907 LogParam(p.name, l); |
| 908 l->append(L", "); |
| 909 LogParam(p.value, l); |
| 910 l->append(L", "); |
| 911 LogParam(static_cast<int>(p.role), l); |
| 912 l->append(L", "); |
| 913 LogParam(static_cast<int>(p.state), l); |
| 914 l->append(L", "); |
| 915 LogParam(p.location, l); |
| 916 l->append(L", "); |
| 917 LogParam(p.attributes, l); |
| 918 l->append(L", "); |
| 919 LogParam(p.children, l); |
| 920 l->append(L")"); |
| 921 } |
| 922 |
| 923 } // namespace IPC |
OLD | NEW |