OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gfx/native_widget_types.h" |
13 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
14 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "chrome/common/bitmap_wire_data.h" |
15 #include "chrome/common/filter_policy.h" | 17 #include "chrome/common/filter_policy.h" |
16 #include "chrome/common/ipc_message.h" | 18 #include "chrome/common/ipc_message.h" |
17 #include "chrome/common/ipc_message_utils.h" | 19 #include "chrome/common/ipc_message_utils.h" |
18 #include "chrome/common/modal_dialog_event.h" | 20 #include "chrome/common/modal_dialog_event.h" |
19 #include "chrome/common/page_transition_types.h" | 21 #include "chrome/common/page_transition_types.h" |
20 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
21 #include "net/base/upload_data.h" | 23 #include "net/base/upload_data.h" |
22 #include "net/url_request/url_request_status.h" | 24 #include "net/url_request/url_request_status.h" |
23 #include "webkit/glue/autofill_form.h" | 25 #include "webkit/glue/autofill_form.h" |
24 #include "webkit/glue/cache_manager.h" | 26 #include "webkit/glue/cache_manager.h" |
25 #include "webkit/glue/context_node_types.h" | 27 #include "webkit/glue/context_node_types.h" |
26 #include "webkit/glue/form_data.h" | 28 #include "webkit/glue/form_data.h" |
27 #include "webkit/glue/password_form.h" | 29 #include "webkit/glue/password_form.h" |
28 #include "webkit/glue/password_form_dom_manager.h" | 30 #include "webkit/glue/password_form_dom_manager.h" |
29 #include "webkit/glue/resource_loader_bridge.h" | 31 #include "webkit/glue/resource_loader_bridge.h" |
30 #include "webkit/glue/screen_info.h" | 32 #include "webkit/glue/screen_info.h" |
31 #include "webkit/glue/webdropdata.h" | 33 #include "webkit/glue/webdropdata.h" |
32 #include "webkit/glue/webplugin.h" | 34 #include "webkit/glue/webplugin.h" |
33 #include "webkit/glue/webpreferences.h" | 35 #include "webkit/glue/webpreferences.h" |
34 #include "webkit/glue/webview_delegate.h" | 36 #include "webkit/glue/webview_delegate.h" |
35 | 37 |
| 38 #if defined(OS_POSIX) |
| 39 #include "skia/include/SkBitmap.h" |
| 40 #endif |
| 41 |
36 // Parameters structure for ViewMsg_Navigate, which has too many data | 42 // Parameters structure for ViewMsg_Navigate, which has too many data |
37 // parameters to be reasonably put in a predefined IPC message. | 43 // parameters to be reasonably put in a predefined IPC message. |
38 struct ViewMsg_Navigate_Params { | 44 struct ViewMsg_Navigate_Params { |
39 // The page_id for this navigation, or -1 if it is a new navigation. Back, | 45 // The page_id for this navigation, or -1 if it is a new navigation. Back, |
40 // Forward, and Reload navigations should have a valid page_id. If the load | 46 // Forward, and Reload navigations should have a valid page_id. If the load |
41 // succeeds, then this page_id will be reflected in the resultant | 47 // succeeds, then this page_id will be reflected in the resultant |
42 // ViewHostMsg_FrameNavigate message. | 48 // ViewHostMsg_FrameNavigate message. |
43 int32 page_id; | 49 int32 page_id; |
44 | 50 |
45 // The URL to load. | 51 // The URL to load. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 189 } |
184 static bool is_restore_ack(int flags) { | 190 static bool is_restore_ack(int flags) { |
185 return (flags & IS_RESTORE_ACK) != 0; | 191 return (flags & IS_RESTORE_ACK) != 0; |
186 } | 192 } |
187 | 193 |
188 static bool is_repaint_ack(int flags) { | 194 static bool is_repaint_ack(int flags) { |
189 return (flags & IS_REPAINT_ACK) != 0; | 195 return (flags & IS_REPAINT_ACK) != 0; |
190 } | 196 } |
191 }; | 197 }; |
192 | 198 |
193 #if defined(OS_WIN) | |
194 // TODO(port): Make these structs portable. | |
195 | |
196 struct ViewHostMsg_PaintRect_Params { | 199 struct ViewHostMsg_PaintRect_Params { |
197 // The bitmap to be painted into the rect given by bitmap_rect. Valid only | 200 // The bitmap to be painted into the rect given by bitmap_rect. |
198 // in the context of the renderer process. | 201 BitmapWireData bitmap; |
199 base::SharedMemoryHandle bitmap; | |
200 | 202 |
201 // The position and size of the bitmap. | 203 // The position and size of the bitmap. |
202 gfx::Rect bitmap_rect; | 204 gfx::Rect bitmap_rect; |
203 | 205 |
204 // The size of the RenderView when this message was generated. This is | 206 // The size of the RenderView when this message was generated. This is |
205 // included so the host knows how large the view is from the perspective of | 207 // included so the host knows how large the view is from the perspective of |
206 // the renderer process. This is necessary in case a resize operation is in | 208 // the renderer process. This is necessary in case a resize operation is in |
207 // progress. | 209 // progress. |
208 gfx::Size view_size; | 210 gfx::Size view_size; |
209 | 211 |
(...skipping 11 matching lines...) Expand all Loading... |
221 // If flags is zero, then this message corresponds to an unsoliticed paint | 223 // If flags is zero, then this message corresponds to an unsoliticed paint |
222 // request by the render view. Both of the above bits may be set in flags, | 224 // request by the render view. Both of the above bits may be set in flags, |
223 // which would indicate that this paint message is an ACK for multiple | 225 // which would indicate that this paint message is an ACK for multiple |
224 // request messages. | 226 // request messages. |
225 int flags; | 227 int flags; |
226 }; | 228 }; |
227 | 229 |
228 // Parameters structure for ViewHostMsg_ScrollRect, which has too many data | 230 // Parameters structure for ViewHostMsg_ScrollRect, which has too many data |
229 // parameters to be reasonably put in a predefined IPC message. | 231 // parameters to be reasonably put in a predefined IPC message. |
230 struct ViewHostMsg_ScrollRect_Params { | 232 struct ViewHostMsg_ScrollRect_Params { |
231 // The bitmap to be painted into the rect exposed by scrolling. This handle | 233 // The bitmap to be painted into the rect exposed by scrolling. |
232 // is valid only in the context of the renderer process. | 234 BitmapWireData bitmap; |
233 base::SharedMemoryHandle bitmap; | |
234 | 235 |
235 // The position and size of the bitmap. | 236 // The position and size of the bitmap. |
236 gfx::Rect bitmap_rect; | 237 gfx::Rect bitmap_rect; |
237 | 238 |
238 // The scroll offset. Only one of these can be non-zero. | 239 // The scroll offset. Only one of these can be non-zero. |
239 int dx; | 240 int dx; |
240 int dy; | 241 int dy; |
241 | 242 |
242 // The rectangular region to scroll. | 243 // The rectangular region to scroll. |
243 gfx::Rect clip_rect; | 244 gfx::Rect clip_rect; |
244 | 245 |
245 // The size of the RenderView when this message was generated. | 246 // The size of the RenderView when this message was generated. |
246 gfx::Size view_size; | 247 gfx::Size view_size; |
247 | 248 |
248 // New window locations for plugin child windows. | 249 // New window locations for plugin child windows. |
249 std::vector<WebPluginGeometry> plugin_window_moves; | 250 std::vector<WebPluginGeometry> plugin_window_moves; |
250 }; | 251 }; |
251 #endif // defined(OS_WIN) | |
252 | 252 |
253 // Parameters structure for ViewMsg_UploadFile. | 253 // Parameters structure for ViewMsg_UploadFile. |
254 struct ViewMsg_UploadFile_Params { | 254 struct ViewMsg_UploadFile_Params { |
255 // See WebContents::StartFileUpload for a description of these fields. | 255 // See WebContents::StartFileUpload for a description of these fields. |
256 std::wstring file_path; | 256 std::wstring file_path; |
257 std::wstring form; | 257 std::wstring form; |
258 std::wstring file; | 258 std::wstring file; |
259 std::wstring submit; | 259 std::wstring submit; |
260 std::wstring other_values; | 260 std::wstring other_values; |
261 }; | 261 }; |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 ReadParam(m, iter, &p->dictionary_suggestions) && | 960 ReadParam(m, iter, &p->dictionary_suggestions) && |
961 ReadParam(m, iter, &p->spellcheck_enabled) && | 961 ReadParam(m, iter, &p->spellcheck_enabled) && |
962 ReadParam(m, iter, &p->edit_flags) && | 962 ReadParam(m, iter, &p->edit_flags) && |
963 ReadParam(m, iter, &p->security_info); | 963 ReadParam(m, iter, &p->security_info); |
964 } | 964 } |
965 static void Log(const param_type& p, std::wstring* l) { | 965 static void Log(const param_type& p, std::wstring* l) { |
966 l->append(L"<ViewHostMsg_ContextMenu_Params>"); | 966 l->append(L"<ViewHostMsg_ContextMenu_Params>"); |
967 } | 967 } |
968 }; | 968 }; |
969 | 969 |
970 #if defined(OS_WIN) | |
971 // TODO(port): Make these messages portable. | |
972 | |
973 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. | 970 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. |
974 template <> | 971 template <> |
975 struct ParamTraits<ViewHostMsg_PaintRect_Params> { | 972 struct ParamTraits<ViewHostMsg_PaintRect_Params> { |
976 typedef ViewHostMsg_PaintRect_Params param_type; | 973 typedef ViewHostMsg_PaintRect_Params param_type; |
977 static void Write(Message* m, const param_type& p) { | 974 static void Write(Message* m, const param_type& p) { |
978 WriteParam(m, p.bitmap); | 975 WriteParam(m, p.bitmap); |
979 WriteParam(m, p.bitmap_rect); | 976 WriteParam(m, p.bitmap_rect); |
980 WriteParam(m, p.view_size); | 977 WriteParam(m, p.view_size); |
981 WriteParam(m, p.plugin_window_moves); | 978 WriteParam(m, p.plugin_window_moves); |
982 WriteParam(m, p.flags); | 979 WriteParam(m, p.flags); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 LogParam(p.window_rect, l); | 1068 LogParam(p.window_rect, l); |
1072 l->append(L", "); | 1069 l->append(L", "); |
1073 LogParam(p.clip_rect, l); | 1070 LogParam(p.clip_rect, l); |
1074 l->append(L", "); | 1071 l->append(L", "); |
1075 LogParam(p.cutout_rects, l); | 1072 LogParam(p.cutout_rects, l); |
1076 l->append(L", "); | 1073 l->append(L", "); |
1077 LogParam(p.visible, l); | 1074 LogParam(p.visible, l); |
1078 l->append(L")"); | 1075 l->append(L")"); |
1079 } | 1076 } |
1080 }; | 1077 }; |
1081 #endif // defined(OS_WIN) | |
1082 | 1078 |
1083 // Traits for ViewMsg_GetPlugins_Reply structure to pack/unpack. | 1079 // Traits for ViewMsg_GetPlugins_Reply structure to pack/unpack. |
1084 template <> | 1080 template <> |
1085 struct ParamTraits<WebPluginMimeType> { | 1081 struct ParamTraits<WebPluginMimeType> { |
1086 typedef WebPluginMimeType param_type; | 1082 typedef WebPluginMimeType param_type; |
1087 static void Write(Message* m, const param_type& p) { | 1083 static void Write(Message* m, const param_type& p) { |
1088 WriteParam(m, p.mime_type); | 1084 WriteParam(m, p.mime_type); |
1089 WriteParam(m, p.file_extensions); | 1085 WriteParam(m, p.file_extensions); |
1090 WriteParam(m, p.description); | 1086 WriteParam(m, p.description); |
1091 } | 1087 } |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 static bool Read(const Message* m, void** iter, param_type* p) { | 1727 static bool Read(const Message* m, void** iter, param_type* p) { |
1732 return true; | 1728 return true; |
1733 } | 1729 } |
1734 #endif | 1730 #endif |
1735 | 1731 |
1736 static void Log(const param_type& p, std::wstring* l) { | 1732 static void Log(const param_type& p, std::wstring* l) { |
1737 l->append(L"<ModalDialogEvent>"); | 1733 l->append(L"<ModalDialogEvent>"); |
1738 } | 1734 } |
1739 }; | 1735 }; |
1740 | 1736 |
| 1737 #if defined(OS_POSIX) |
| 1738 |
| 1739 // TODO(port): this shouldn't exist. However, the plugin stuff is really using |
| 1740 // HWNDS (NativeView), and making Windows calls based on them. I've not figured |
| 1741 // out the deal with plugins yet. |
| 1742 template <> |
| 1743 struct ParamTraits<gfx::NativeView> { |
| 1744 typedef gfx::NativeView param_type; |
| 1745 static void Write(Message* m, const param_type& p) { |
| 1746 NOTIMPLEMENTED(); |
| 1747 } |
| 1748 |
| 1749 static bool Read(const Message* m, void** iter, param_type* p) { |
| 1750 NOTIMPLEMENTED(); |
| 1751 *p = NULL; |
| 1752 return true; |
| 1753 } |
| 1754 |
| 1755 static void Log(const param_type& p, std::wstring* l) { |
| 1756 l->append(StringPrintf(L"<gfx::NativeView>")); |
| 1757 } |
| 1758 }; |
| 1759 |
| 1760 #endif // defined(OS_POSIX) |
| 1761 |
1741 } // namespace IPC | 1762 } // namespace IPC |
1742 | 1763 |
1743 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 1764 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
OLD | NEW |