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 #include "base/values.h" | 5 #include "base/values.h" |
6 #include "chrome/common/edit_command.h" | 6 #include "chrome/common/edit_command.h" |
7 #include "chrome/common/extensions/extension_extent.h" | 7 #include "chrome/common/extensions/extension_extent.h" |
8 #include "chrome/common/extensions/url_pattern.h" | 8 #include "chrome/common/extensions/url_pattern.h" |
9 #include "chrome/common/gpu_param_traits.h" | 9 #include "chrome/common/gpu_param_traits.h" |
10 #include "chrome/common/render_messages_params.h" | 10 #include "chrome/common/render_messages_params.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return false; | 48 return false; |
49 *p = static_cast<WebMenuItem::Type>(type); | 49 *p = static_cast<WebMenuItem::Type>(type); |
50 return true; | 50 return true; |
51 } | 51 } |
52 static void Log(const param_type& p, std::string* l) { | 52 static void Log(const param_type& p, std::string* l) { |
53 std::string type; | 53 std::string type; |
54 switch (p) { | 54 switch (p) { |
55 case WebMenuItem::OPTION: | 55 case WebMenuItem::OPTION: |
56 type = "OPTION"; | 56 type = "OPTION"; |
57 break; | 57 break; |
| 58 case WebMenuItem::CHECKABLE_OPTION: |
| 59 type = "CHECKABLE_OPTION"; |
| 60 break; |
58 case WebMenuItem::GROUP: | 61 case WebMenuItem::GROUP: |
59 type = "GROUP"; | 62 type = "GROUP"; |
60 break; | 63 break; |
61 case WebMenuItem::SEPARATOR: | 64 case WebMenuItem::SEPARATOR: |
62 type = "SEPARATOR"; | 65 type = "SEPARATOR"; |
63 break; | 66 break; |
| 67 case WebMenuItem::SUBMENU: |
| 68 type = "SUBMENU"; |
| 69 break; |
64 default: | 70 default: |
65 type = "UNKNOWN"; | 71 type = "UNKNOWN"; |
66 break; | 72 break; |
67 } | 73 } |
68 LogParam(type, l); | 74 LogParam(type, l); |
69 } | 75 } |
70 }; | 76 }; |
71 | 77 |
72 #if defined(OS_MACOSX) | 78 #if defined(OS_MACOSX) |
73 void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { | 79 void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { |
74 WriteParam(m, p.font_name); | 80 WriteParam(m, p.font_name); |
75 WriteParam(m, p.font_point_size); | 81 WriteParam(m, p.font_point_size); |
76 } | 82 } |
77 | 83 |
78 bool ParamTraits<FontDescriptor>::Read(const Message* m, | 84 bool ParamTraits<FontDescriptor>::Read(const Message* m, |
79 void** iter, | 85 void** iter, |
80 param_type* p) { | 86 param_type* p) { |
81 return( | 87 return |
82 ReadParam(m, iter, &p->font_name) && | 88 ReadParam(m, iter, &p->font_name) && |
83 ReadParam(m, iter, &p->font_point_size)); | 89 ReadParam(m, iter, &p->font_point_size); |
84 } | 90 } |
85 | 91 |
86 void ParamTraits<FontDescriptor>::Log(const param_type& p, std::string* l) { | 92 void ParamTraits<FontDescriptor>::Log(const param_type& p, std::string* l) { |
87 l->append("<FontDescriptor>"); | 93 l->append("<FontDescriptor>"); |
88 } | 94 } |
89 #endif | 95 #endif |
90 | 96 |
| 97 void ParamTraits<webkit_glue::CustomContextMenuContext>::Write( |
| 98 Message* m, |
| 99 const param_type& p) { |
| 100 WriteParam(m, p.is_pepper_menu); |
| 101 WriteParam(m, p.request_id); |
| 102 } |
| 103 |
| 104 bool ParamTraits<webkit_glue::CustomContextMenuContext>::Read(const Message* m, |
| 105 void** iter, |
| 106 param_type* p) { |
| 107 return |
| 108 ReadParam(m, iter, &p->is_pepper_menu) && |
| 109 ReadParam(m, iter, &p->request_id); |
| 110 } |
| 111 |
| 112 void ParamTraits<webkit_glue::CustomContextMenuContext>::Log( |
| 113 const param_type& p, |
| 114 std::string* l) { |
| 115 l->append("("); |
| 116 LogParam(p.is_pepper_menu, l); |
| 117 l->append(", "); |
| 118 LogParam(p.request_id, l); |
| 119 l->append(")"); |
| 120 } |
| 121 |
91 void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { | 122 void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { |
92 WriteParam(m, p.media_type); | 123 WriteParam(m, p.media_type); |
93 WriteParam(m, p.x); | 124 WriteParam(m, p.x); |
94 WriteParam(m, p.y); | 125 WriteParam(m, p.y); |
95 WriteParam(m, p.link_url); | 126 WriteParam(m, p.link_url); |
96 WriteParam(m, p.unfiltered_link_url); | 127 WriteParam(m, p.unfiltered_link_url); |
97 WriteParam(m, p.src_url); | 128 WriteParam(m, p.src_url); |
98 WriteParam(m, p.is_image_blocked); | 129 WriteParam(m, p.is_image_blocked); |
99 WriteParam(m, p.page_url); | 130 WriteParam(m, p.page_url); |
100 WriteParam(m, p.frame_url); | 131 WriteParam(m, p.frame_url); |
101 WriteParam(m, p.media_flags); | 132 WriteParam(m, p.media_flags); |
102 WriteParam(m, p.selection_text); | 133 WriteParam(m, p.selection_text); |
103 WriteParam(m, p.misspelled_word); | 134 WriteParam(m, p.misspelled_word); |
104 WriteParam(m, p.dictionary_suggestions); | 135 WriteParam(m, p.dictionary_suggestions); |
105 WriteParam(m, p.spellcheck_enabled); | 136 WriteParam(m, p.spellcheck_enabled); |
106 WriteParam(m, p.is_editable); | 137 WriteParam(m, p.is_editable); |
107 #if defined(OS_MACOSX) | 138 #if defined(OS_MACOSX) |
108 WriteParam(m, p.writing_direction_default); | 139 WriteParam(m, p.writing_direction_default); |
109 WriteParam(m, p.writing_direction_left_to_right); | 140 WriteParam(m, p.writing_direction_left_to_right); |
110 WriteParam(m, p.writing_direction_right_to_left); | 141 WriteParam(m, p.writing_direction_right_to_left); |
111 #endif // OS_MACOSX | 142 #endif // OS_MACOSX |
112 WriteParam(m, p.edit_flags); | 143 WriteParam(m, p.edit_flags); |
113 WriteParam(m, p.security_info); | 144 WriteParam(m, p.security_info); |
114 WriteParam(m, p.frame_charset); | 145 WriteParam(m, p.frame_charset); |
| 146 WriteParam(m, p.custom_context); |
115 WriteParam(m, p.custom_items); | 147 WriteParam(m, p.custom_items); |
116 } | 148 } |
117 | 149 |
118 bool ParamTraits<ContextMenuParams>::Read(const Message* m, void** iter, | 150 bool ParamTraits<ContextMenuParams>::Read(const Message* m, void** iter, |
119 param_type* p) { | 151 param_type* p) { |
120 return | 152 return |
121 ReadParam(m, iter, &p->media_type) && | 153 ReadParam(m, iter, &p->media_type) && |
122 ReadParam(m, iter, &p->x) && | 154 ReadParam(m, iter, &p->x) && |
123 ReadParam(m, iter, &p->y) && | 155 ReadParam(m, iter, &p->y) && |
124 ReadParam(m, iter, &p->link_url) && | 156 ReadParam(m, iter, &p->link_url) && |
125 ReadParam(m, iter, &p->unfiltered_link_url) && | 157 ReadParam(m, iter, &p->unfiltered_link_url) && |
126 ReadParam(m, iter, &p->src_url) && | 158 ReadParam(m, iter, &p->src_url) && |
127 ReadParam(m, iter, &p->is_image_blocked) && | 159 ReadParam(m, iter, &p->is_image_blocked) && |
128 ReadParam(m, iter, &p->page_url) && | 160 ReadParam(m, iter, &p->page_url) && |
129 ReadParam(m, iter, &p->frame_url) && | 161 ReadParam(m, iter, &p->frame_url) && |
130 ReadParam(m, iter, &p->media_flags) && | 162 ReadParam(m, iter, &p->media_flags) && |
131 ReadParam(m, iter, &p->selection_text) && | 163 ReadParam(m, iter, &p->selection_text) && |
132 ReadParam(m, iter, &p->misspelled_word) && | 164 ReadParam(m, iter, &p->misspelled_word) && |
133 ReadParam(m, iter, &p->dictionary_suggestions) && | 165 ReadParam(m, iter, &p->dictionary_suggestions) && |
134 ReadParam(m, iter, &p->spellcheck_enabled) && | 166 ReadParam(m, iter, &p->spellcheck_enabled) && |
135 ReadParam(m, iter, &p->is_editable) && | 167 ReadParam(m, iter, &p->is_editable) && |
136 #if defined(OS_MACOSX) | 168 #if defined(OS_MACOSX) |
137 ReadParam(m, iter, &p->writing_direction_default) && | 169 ReadParam(m, iter, &p->writing_direction_default) && |
138 ReadParam(m, iter, &p->writing_direction_left_to_right) && | 170 ReadParam(m, iter, &p->writing_direction_left_to_right) && |
139 ReadParam(m, iter, &p->writing_direction_right_to_left) && | 171 ReadParam(m, iter, &p->writing_direction_right_to_left) && |
140 #endif // OS_MACOSX | 172 #endif // OS_MACOSX |
141 ReadParam(m, iter, &p->edit_flags) && | 173 ReadParam(m, iter, &p->edit_flags) && |
142 ReadParam(m, iter, &p->security_info) && | 174 ReadParam(m, iter, &p->security_info) && |
143 ReadParam(m, iter, &p->frame_charset) && | 175 ReadParam(m, iter, &p->frame_charset) && |
| 176 ReadParam(m, iter, &p->custom_context) && |
144 ReadParam(m, iter, &p->custom_items); | 177 ReadParam(m, iter, &p->custom_items); |
145 } | 178 } |
146 | 179 |
147 void ParamTraits<ContextMenuParams>::Log(const param_type& p, | 180 void ParamTraits<ContextMenuParams>::Log(const param_type& p, |
148 std::string* l) { | 181 std::string* l) { |
149 l->append("<ContextMenuParams>"); | 182 l->append("<ContextMenuParams>"); |
150 } | 183 } |
151 | 184 |
152 void ParamTraits<webkit::npapi::WebPluginGeometry>::Write(Message* m, | 185 void ParamTraits<webkit::npapi::WebPluginGeometry>::Write(Message* m, |
153 const param_type& p) { | 186 const param_type& p) { |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 void ParamTraits<WebDropData>::Log(const param_type& p, std::string* l) { | 768 void ParamTraits<WebDropData>::Log(const param_type& p, std::string* l) { |
736 l->append("<WebDropData>"); | 769 l->append("<WebDropData>"); |
737 } | 770 } |
738 | 771 |
739 void ParamTraits<WebMenuItem>::Write(Message* m, const param_type& p) { | 772 void ParamTraits<WebMenuItem>::Write(Message* m, const param_type& p) { |
740 WriteParam(m, p.label); | 773 WriteParam(m, p.label); |
741 WriteParam(m, p.type); | 774 WriteParam(m, p.type); |
742 WriteParam(m, p.enabled); | 775 WriteParam(m, p.enabled); |
743 WriteParam(m, p.checked); | 776 WriteParam(m, p.checked); |
744 WriteParam(m, p.action); | 777 WriteParam(m, p.action); |
| 778 WriteParam(m, p.submenu); |
745 } | 779 } |
746 | 780 |
747 bool ParamTraits<WebMenuItem>::Read(const Message* m, | 781 bool ParamTraits<WebMenuItem>::Read(const Message* m, |
748 void** iter, | 782 void** iter, |
749 param_type* p) { | 783 param_type* p) { |
750 return | 784 return |
751 ReadParam(m, iter, &p->label) && | 785 ReadParam(m, iter, &p->label) && |
752 ReadParam(m, iter, &p->type) && | 786 ReadParam(m, iter, &p->type) && |
753 ReadParam(m, iter, &p->enabled) && | 787 ReadParam(m, iter, &p->enabled) && |
754 ReadParam(m, iter, &p->checked) && | 788 ReadParam(m, iter, &p->checked) && |
755 ReadParam(m, iter, &p->action); | 789 ReadParam(m, iter, &p->action) && |
| 790 ReadParam(m, iter, &p->submenu); |
756 } | 791 } |
757 | 792 |
758 void ParamTraits<WebMenuItem>::Log(const param_type& p, std::string* l) { | 793 void ParamTraits<WebMenuItem>::Log(const param_type& p, std::string* l) { |
759 l->append("("); | 794 l->append("("); |
760 LogParam(p.label, l); | 795 LogParam(p.label, l); |
761 l->append(", "); | 796 l->append(", "); |
762 LogParam(p.type, l); | 797 LogParam(p.type, l); |
763 l->append(", "); | 798 l->append(", "); |
764 LogParam(p.enabled, l); | 799 LogParam(p.enabled, l); |
765 l->append(", "); | 800 l->append(", "); |
766 LogParam(p.checked, l); | 801 LogParam(p.checked, l); |
767 l->append(", "); | 802 l->append(", "); |
768 LogParam(p.action, l); | 803 LogParam(p.action, l); |
| 804 l->append(", "); |
| 805 LogParam(p.submenu, l); |
769 l->append(")"); | 806 l->append(")"); |
770 } | 807 } |
771 | 808 |
772 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { | 809 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { |
773 WriteParam(m, p.valid_schemes()); | 810 WriteParam(m, p.valid_schemes()); |
774 WriteParam(m, p.GetAsString()); | 811 WriteParam(m, p.GetAsString()); |
775 } | 812 } |
776 | 813 |
777 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, | 814 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, |
778 param_type* p) { | 815 param_type* p) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 l->append("("); | 1160 l->append("("); |
1124 LogParam(p.pending_bytes, l); | 1161 LogParam(p.pending_bytes, l); |
1125 l->append(", "); | 1162 l->append(", "); |
1126 LogParam(p.hardware_delay_bytes, l); | 1163 LogParam(p.hardware_delay_bytes, l); |
1127 l->append(", "); | 1164 l->append(", "); |
1128 LogParam(p.timestamp, l); | 1165 LogParam(p.timestamp, l); |
1129 l->append(")"); | 1166 l->append(")"); |
1130 } | 1167 } |
1131 | 1168 |
1132 } // namespace IPC | 1169 } // namespace IPC |
OLD | NEW |