| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/common/render_messages.h" | 5 #include "chrome/common/render_messages.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/edit_command.h" | 8 #include "chrome/common/edit_command.h" |
| 9 #include "chrome/common/extensions/extension_extent.h" | 9 #include "chrome/common/extensions/extension_extent.h" |
| 10 #include "chrome/common/extensions/url_pattern.h" | 10 #include "chrome/common/extensions/url_pattern.h" |
| 11 #include "chrome/common/indexed_db_param_traits.h" | 11 #include "chrome/common/indexed_db_param_traits.h" |
| 12 #include "chrome/common/render_messages_params.h" |
| 12 #include "chrome/common/thumbnail_score.h" | 13 #include "chrome/common/thumbnail_score.h" |
| 13 #include "gfx/rect.h" | 14 #include "gfx/rect.h" |
| 14 #include "ipc/ipc_channel_handle.h" | 15 #include "ipc/ipc_channel_handle.h" |
| 16 #include "net/base/upload_data.h" |
| 15 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 16 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 17 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
| 21 #include "webkit/appcache/appcache_interfaces.h" | 23 #include "webkit/appcache/appcache_interfaces.h" |
| 22 #include "webkit/glue/context_menu.h" | 24 #include "webkit/glue/context_menu.h" |
| 23 #include "webkit/glue/form_data.h" | 25 #include "webkit/glue/form_data.h" |
| 24 #include "webkit/glue/form_field.h" | 26 #include "webkit/glue/form_field.h" |
| 25 #include "webkit/glue/password_form_dom_manager.h" | 27 #include "webkit/glue/password_form_dom_manager.h" |
| 26 #include "webkit/glue/password_form.h" | 28 #include "webkit/glue/password_form.h" |
| 27 #include "webkit/glue/webaccessibility.h" | 29 #include "webkit/glue/webaccessibility.h" |
| 28 #include "webkit/glue/webcookie.h" | 30 #include "webkit/glue/webcookie.h" |
| 29 #include "webkit/glue/webcursor.h" | 31 #include "webkit/glue/webcursor.h" |
| 30 #include "webkit/glue/webdropdata.h" | 32 #include "webkit/glue/webdropdata.h" |
| 31 #include "webkit/glue/plugins/webplugin.h" | 33 #include "webkit/glue/plugins/webplugin.h" |
| 32 #include "webkit/glue/plugins/webplugininfo.h" | 34 #include "webkit/glue/plugins/webplugininfo.h" |
| 33 #include "webkit/glue/dom_operations.h" | 35 #include "webkit/glue/dom_operations.h" |
| 36 #include "webkit/glue/webmenuitem.h" |
| 37 |
| 38 #if defined(OS_MACOSX) |
| 39 #include "chrome/common/font_descriptor_mac.h" |
| 40 #endif |
| 34 | 41 |
| 35 #define MESSAGES_INTERNAL_IMPL_FILE \ | 42 #define MESSAGES_INTERNAL_IMPL_FILE \ |
| 36 "chrome/common/render_messages_internal.h" | 43 "chrome/common/render_messages_internal.h" |
| 37 #include "ipc/ipc_message_impl_macros.h" | 44 #include "ipc/ipc_message_impl_macros.h" |
| 38 | 45 |
| 39 namespace IPC { | 46 namespace IPC { |
| 40 | 47 |
| 41 void ParamTraits<ViewMsg_Navigate_Params>::Write(Message* m, | |
| 42 const param_type& p) { | |
| 43 WriteParam(m, p.page_id); | |
| 44 WriteParam(m, p.pending_history_list_offset); | |
| 45 WriteParam(m, p.current_history_list_offset); | |
| 46 WriteParam(m, p.current_history_list_length); | |
| 47 WriteParam(m, p.url); | |
| 48 WriteParam(m, p.referrer); | |
| 49 WriteParam(m, p.transition); | |
| 50 WriteParam(m, p.state); | |
| 51 WriteParam(m, p.navigation_type); | |
| 52 WriteParam(m, p.request_time); | |
| 53 } | |
| 54 | 48 |
| 55 bool ParamTraits<ViewMsg_Navigate_Params>::Read(const Message* m, void** iter, | 49 template<> |
| 56 param_type* p) { | 50 struct ParamTraits<WebMenuItem::Type> { |
| 57 return | 51 typedef WebMenuItem::Type param_type; |
| 58 ReadParam(m, iter, &p->page_id) && | 52 static void Write(Message* m, const param_type& p) { |
| 59 ReadParam(m, iter, &p->pending_history_list_offset) && | 53 m->WriteInt(p); |
| 60 ReadParam(m, iter, &p->current_history_list_offset) && | 54 } |
| 61 ReadParam(m, iter, &p->current_history_list_length) && | 55 static bool Read(const Message* m, void** iter, param_type* p) { |
| 62 ReadParam(m, iter, &p->url) && | 56 int type; |
| 63 ReadParam(m, iter, &p->referrer) && | 57 if (!m->ReadInt(iter, &type)) |
| 64 ReadParam(m, iter, &p->transition) && | 58 return false; |
| 65 ReadParam(m, iter, &p->state) && | 59 *p = static_cast<WebMenuItem::Type>(type); |
| 66 ReadParam(m, iter, &p->navigation_type) && | 60 return true; |
| 67 ReadParam(m, iter, &p->request_time); | 61 } |
| 68 } | 62 static void Log(const param_type& p, std::string* l) { |
| 63 std::string type; |
| 64 switch (p) { |
| 65 case WebMenuItem::OPTION: |
| 66 type = "OPTION"; |
| 67 break; |
| 68 case WebMenuItem::GROUP: |
| 69 type = "GROUP"; |
| 70 break; |
| 71 case WebMenuItem::SEPARATOR: |
| 72 type = "SEPARATOR"; |
| 73 break; |
| 74 default: |
| 75 type = "UNKNOWN"; |
| 76 break; |
| 77 } |
| 78 LogParam(type, l); |
| 79 } |
| 80 }; |
| 69 | 81 |
| 70 void ParamTraits<ViewMsg_Navigate_Params>::Log(const param_type& p, | |
| 71 std::string* l) { | |
| 72 l->append("("); | |
| 73 LogParam(p.page_id, l); | |
| 74 l->append(", "); | |
| 75 LogParam(p.url, l); | |
| 76 l->append(", "); | |
| 77 LogParam(p.transition, l); | |
| 78 l->append(", "); | |
| 79 LogParam(p.state, l); | |
| 80 l->append(", "); | |
| 81 LogParam(p.navigation_type, l); | |
| 82 l->append(", "); | |
| 83 LogParam(p.request_time, l); | |
| 84 l->append(")"); | |
| 85 } | |
| 86 | 82 |
| 87 void ParamTraits<webkit_glue::FormField>::Write(Message* m, | 83 void ParamTraits<webkit_glue::FormField>::Write(Message* m, |
| 88 const param_type& p) { | 84 const param_type& p) { |
| 89 WriteParam(m, p.label()); | 85 WriteParam(m, p.label()); |
| 90 WriteParam(m, p.name()); | 86 WriteParam(m, p.name()); |
| 91 WriteParam(m, p.value()); | 87 WriteParam(m, p.value()); |
| 92 WriteParam(m, p.form_control_type()); | 88 WriteParam(m, p.form_control_type()); |
| 93 WriteParam(m, p.size()); | 89 WriteParam(m, p.size()); |
| 94 WriteParam(m, p.option_strings()); | 90 WriteParam(m, p.option_strings()); |
| 95 } | 91 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 p->set_size(size); | 111 p->set_size(size); |
| 116 p->set_option_strings(options); | 112 p->set_option_strings(options); |
| 117 return true; | 113 return true; |
| 118 } | 114 } |
| 119 | 115 |
| 120 void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, | 116 void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, |
| 121 std::string* l) { | 117 std::string* l) { |
| 122 l->append("<FormField>"); | 118 l->append("<FormField>"); |
| 123 } | 119 } |
| 124 | 120 |
| 121 #if defined(OS_MACOSX) |
| 122 void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { |
| 123 WriteParam(m, p.font_name); |
| 124 WriteParam(m, p.font_point_size); |
| 125 } |
| 126 |
| 127 bool ParamTraits<FontDescriptor>::Read(const Message* m, |
| 128 void** iter, |
| 129 param_type* p) { |
| 130 return( |
| 131 ReadParam(m, iter, &p->font_name) && |
| 132 ReadParam(m, iter, &p->font_point_size)); |
| 133 } |
| 134 |
| 135 void ParamTraits<FontDescriptor>::Log(const param_type& p, std::string* l) { |
| 136 l->append("<FontDescriptor>"); |
| 137 } |
| 138 #endif |
| 139 |
| 125 void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { | 140 void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { |
| 126 WriteParam(m, p.media_type); | 141 WriteParam(m, p.media_type); |
| 127 WriteParam(m, p.x); | 142 WriteParam(m, p.x); |
| 128 WriteParam(m, p.y); | 143 WriteParam(m, p.y); |
| 129 WriteParam(m, p.link_url); | 144 WriteParam(m, p.link_url); |
| 130 WriteParam(m, p.unfiltered_link_url); | 145 WriteParam(m, p.unfiltered_link_url); |
| 131 WriteParam(m, p.src_url); | 146 WriteParam(m, p.src_url); |
| 132 WriteParam(m, p.is_image_blocked); | 147 WriteParam(m, p.is_image_blocked); |
| 133 WriteParam(m, p.page_url); | 148 WriteParam(m, p.page_url); |
| 134 WriteParam(m, p.frame_url); | 149 WriteParam(m, p.frame_url); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ReadParam(m, iter, &p->security_info) && | 191 ReadParam(m, iter, &p->security_info) && |
| 177 ReadParam(m, iter, &p->frame_charset) && | 192 ReadParam(m, iter, &p->frame_charset) && |
| 178 ReadParam(m, iter, &p->custom_items); | 193 ReadParam(m, iter, &p->custom_items); |
| 179 } | 194 } |
| 180 | 195 |
| 181 void ParamTraits<ContextMenuParams>::Log(const param_type& p, | 196 void ParamTraits<ContextMenuParams>::Log(const param_type& p, |
| 182 std::string* l) { | 197 std::string* l) { |
| 183 l->append("<ContextMenuParams>"); | 198 l->append("<ContextMenuParams>"); |
| 184 } | 199 } |
| 185 | 200 |
| 186 void ParamTraits<ViewHostMsg_UpdateRect_Params>::Write( | |
| 187 Message* m, const param_type& p) { | |
| 188 WriteParam(m, p.bitmap); | |
| 189 WriteParam(m, p.bitmap_rect); | |
| 190 WriteParam(m, p.dx); | |
| 191 WriteParam(m, p.dy); | |
| 192 WriteParam(m, p.scroll_rect); | |
| 193 WriteParam(m, p.copy_rects); | |
| 194 WriteParam(m, p.view_size); | |
| 195 WriteParam(m, p.plugin_window_moves); | |
| 196 WriteParam(m, p.flags); | |
| 197 } | |
| 198 | |
| 199 bool ParamTraits<ViewHostMsg_UpdateRect_Params>::Read( | |
| 200 const Message* m, void** iter, param_type* p) { | |
| 201 return | |
| 202 ReadParam(m, iter, &p->bitmap) && | |
| 203 ReadParam(m, iter, &p->bitmap_rect) && | |
| 204 ReadParam(m, iter, &p->dx) && | |
| 205 ReadParam(m, iter, &p->dy) && | |
| 206 ReadParam(m, iter, &p->scroll_rect) && | |
| 207 ReadParam(m, iter, &p->copy_rects) && | |
| 208 ReadParam(m, iter, &p->view_size) && | |
| 209 ReadParam(m, iter, &p->plugin_window_moves) && | |
| 210 ReadParam(m, iter, &p->flags); | |
| 211 } | |
| 212 | |
| 213 void ParamTraits<ViewHostMsg_UpdateRect_Params>::Log(const param_type& p, | |
| 214 std::string* l) { | |
| 215 l->append("("); | |
| 216 LogParam(p.bitmap, l); | |
| 217 l->append(", "); | |
| 218 LogParam(p.bitmap_rect, l); | |
| 219 l->append(", "); | |
| 220 LogParam(p.dx, l); | |
| 221 l->append(", "); | |
| 222 LogParam(p.dy, l); | |
| 223 l->append(", "); | |
| 224 LogParam(p.scroll_rect, l); | |
| 225 l->append(", "); | |
| 226 LogParam(p.copy_rects, l); | |
| 227 l->append(", "); | |
| 228 LogParam(p.view_size, l); | |
| 229 l->append(", "); | |
| 230 LogParam(p.plugin_window_moves, l); | |
| 231 l->append(", "); | |
| 232 LogParam(p.flags, l); | |
| 233 l->append(")"); | |
| 234 } | |
| 235 | |
| 236 void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, | 201 void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, |
| 237 const param_type& p) { | 202 const param_type& p) { |
| 238 WriteParam(m, p.window); | 203 WriteParam(m, p.window); |
| 239 WriteParam(m, p.window_rect); | 204 WriteParam(m, p.window_rect); |
| 240 WriteParam(m, p.clip_rect); | 205 WriteParam(m, p.clip_rect); |
| 241 WriteParam(m, p.cutout_rects); | 206 WriteParam(m, p.cutout_rects); |
| 242 WriteParam(m, p.rects_valid); | 207 WriteParam(m, p.rects_valid); |
| 243 WriteParam(m, p.visible); | 208 WriteParam(m, p.visible); |
| 244 } | 209 } |
| 245 | 210 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ReadParam(m, iter, &p->text_html) && | 566 ReadParam(m, iter, &p->text_html) && |
| 602 ReadParam(m, iter, &p->html_base_url) && | 567 ReadParam(m, iter, &p->html_base_url) && |
| 603 ReadParam(m, iter, &p->file_description_filename) && | 568 ReadParam(m, iter, &p->file_description_filename) && |
| 604 ReadParam(m, iter, &p->file_contents); | 569 ReadParam(m, iter, &p->file_contents); |
| 605 } | 570 } |
| 606 | 571 |
| 607 void ParamTraits<WebDropData>::Log(const param_type& p, std::string* l) { | 572 void ParamTraits<WebDropData>::Log(const param_type& p, std::string* l) { |
| 608 l->append("<WebDropData>"); | 573 l->append("<WebDropData>"); |
| 609 } | 574 } |
| 610 | 575 |
| 576 void ParamTraits<WebMenuItem>::Write(Message* m, const param_type& p) { |
| 577 WriteParam(m, p.label); |
| 578 WriteParam(m, p.type); |
| 579 WriteParam(m, p.enabled); |
| 580 WriteParam(m, p.checked); |
| 581 WriteParam(m, p.action); |
| 582 } |
| 583 |
| 584 bool ParamTraits<WebMenuItem>::Read(const Message* m, |
| 585 void** iter, |
| 586 param_type* p) { |
| 587 return |
| 588 ReadParam(m, iter, &p->label) && |
| 589 ReadParam(m, iter, &p->type) && |
| 590 ReadParam(m, iter, &p->enabled) && |
| 591 ReadParam(m, iter, &p->checked) && |
| 592 ReadParam(m, iter, &p->action); |
| 593 } |
| 594 |
| 595 void ParamTraits<WebMenuItem>::Log(const param_type& p, std::string* l) { |
| 596 l->append("("); |
| 597 LogParam(p.label, l); |
| 598 l->append(", "); |
| 599 LogParam(p.type, l); |
| 600 l->append(", "); |
| 601 LogParam(p.enabled, l); |
| 602 l->append(", "); |
| 603 LogParam(p.checked, l); |
| 604 l->append(", "); |
| 605 LogParam(p.action, l); |
| 606 l->append(")"); |
| 607 } |
| 608 |
| 611 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { | 609 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { |
| 612 WriteParam(m, p.valid_schemes()); | 610 WriteParam(m, p.valid_schemes()); |
| 613 WriteParam(m, p.GetAsString()); | 611 WriteParam(m, p.GetAsString()); |
| 614 } | 612 } |
| 615 | 613 |
| 616 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, | 614 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, |
| 617 param_type* p) { | 615 param_type* p) { |
| 618 int valid_schemes; | 616 int valid_schemes; |
| 619 std::string spec; | 617 std::string spec; |
| 620 if (!ReadParam(m, iter, &valid_schemes) || | 618 if (!ReadParam(m, iter, &valid_schemes) || |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 l->append(", "); | 831 l->append(", "); |
| 834 LogParam(p.location, l); | 832 LogParam(p.location, l); |
| 835 l->append(", "); | 833 l->append(", "); |
| 836 LogParam(p.attributes, l); | 834 LogParam(p.attributes, l); |
| 837 l->append(", "); | 835 l->append(", "); |
| 838 LogParam(p.children, l); | 836 LogParam(p.children, l); |
| 839 l->append(")"); | 837 l->append(")"); |
| 840 } | 838 } |
| 841 | 839 |
| 842 } // namespace IPC | 840 } // namespace IPC |
| OLD | NEW |