OLD | NEW |
1 // Copyright (c) 2010 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 // Multiply-included message file, no traditional include guard. | 5 // Multiply-included message file, no traditional include guard. |
6 #include <string> | 6 #include "chrome/common/automation_message_types.h" |
7 | |
8 #include "base/basictypes.h" | |
9 #include "chrome/common/automation_constants.h" | |
10 #include "chrome/common/content_settings.h" | |
11 #include "chrome/common/security_style.h" | |
12 #include "content/common/common_param_traits.h" | |
13 #include "content/common/page_type.h" | |
14 #include "ipc/ipc_message_macros.h" | |
15 #include "ipc/ipc_message_utils.h" | |
16 #include "net/base/host_port_pair.h" | |
17 #include "net/base/upload_data.h" | |
18 #include "ui/gfx/rect.h" | |
19 | |
20 // Singly-included section, not yet converted. | |
21 #ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H__ | |
22 #define CHROME_COMMON_AUTOMATION_MESSAGES_H__ | |
23 | |
24 struct AutomationMsg_Find_Params { | |
25 // Unused value, which exists only for backwards compat. | |
26 int unused; | |
27 | |
28 // The word(s) to find on the page. | |
29 string16 search_string; | |
30 | |
31 // Whether to search forward or backward within the page. | |
32 bool forward; | |
33 | |
34 // Whether search should be Case sensitive. | |
35 bool match_case; | |
36 | |
37 // Whether this operation is first request (Find) or a follow-up (FindNext). | |
38 bool find_next; | |
39 }; | |
40 | |
41 struct AutomationURLResponse { | |
42 AutomationURLResponse(); | |
43 AutomationURLResponse(const std::string& mime_type, | |
44 const std::string& headers, | |
45 int64 content_length, | |
46 const base::Time& last_modified, | |
47 const std::string& redirect_url, | |
48 int redirect_status, | |
49 const net::HostPortPair& host_socket_address); | |
50 ~AutomationURLResponse(); | |
51 | |
52 std::string mime_type; | |
53 std::string headers; | |
54 int64 content_length; | |
55 base::Time last_modified; | |
56 std::string redirect_url; | |
57 int redirect_status; | |
58 net::HostPortPair socket_address; | |
59 }; | |
60 | |
61 struct ExternalTabSettings { | |
62 ExternalTabSettings(); | |
63 ExternalTabSettings(gfx::NativeWindow parent, | |
64 const gfx::Rect& dimensions, | |
65 unsigned int style, | |
66 bool is_incognito, | |
67 bool load_requests_via_automation, | |
68 bool handle_top_level_requests, | |
69 const GURL& initial_url, | |
70 const GURL& referrer, | |
71 bool infobars_enabled, | |
72 bool route_all_top_level_navigations); | |
73 ~ExternalTabSettings(); | |
74 | |
75 gfx::NativeWindow parent; | |
76 gfx::Rect dimensions; | |
77 unsigned int style; | |
78 bool is_incognito; | |
79 bool load_requests_via_automation; | |
80 bool handle_top_level_requests; | |
81 GURL initial_url; | |
82 GURL referrer; | |
83 bool infobars_enabled; | |
84 bool route_all_top_level_navigations; | |
85 }; | |
86 | |
87 struct NavigationInfo { | |
88 NavigationInfo(); | |
89 NavigationInfo(int navigation_type, | |
90 int relative_offset, | |
91 int navigation_index, | |
92 const std::wstring& title, | |
93 const GURL& url, | |
94 const GURL& referrer, | |
95 SecurityStyle security_style, | |
96 bool displayed_insecure_content, | |
97 bool ran_insecure_content); | |
98 ~NavigationInfo(); | |
99 | |
100 int navigation_type; | |
101 int relative_offset; | |
102 int navigation_index; | |
103 std::wstring title; | |
104 GURL url; | |
105 GURL referrer; | |
106 SecurityStyle security_style; | |
107 bool displayed_insecure_content; | |
108 bool ran_insecure_content; | |
109 }; | |
110 | |
111 // A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. | |
112 struct MiniContextMenuParams { | |
113 MiniContextMenuParams(); | |
114 MiniContextMenuParams(int screen_x, | |
115 int screen_y, | |
116 const GURL& link_url, | |
117 const GURL& unfiltered_link_url, | |
118 const GURL& src_url, | |
119 const GURL& page_url, | |
120 const GURL& frame_url); | |
121 ~MiniContextMenuParams(); | |
122 | |
123 // The x coordinate for displaying the menu. | |
124 int screen_x; | |
125 | |
126 // The y coordinate for displaying the menu. | |
127 int screen_y; | |
128 | |
129 // This is the URL of the link that encloses the node the context menu was | |
130 // invoked on. | |
131 GURL link_url; | |
132 | |
133 // The link URL to be used ONLY for "copy link address". We don't validate | |
134 // this field in the frontend process. | |
135 GURL unfiltered_link_url; | |
136 | |
137 // This is the source URL for the element that the context menu was | |
138 // invoked on. Example of elements with source URLs are img, audio, and | |
139 // video. | |
140 GURL src_url; | |
141 | |
142 // This is the URL of the top level page that the context menu was invoked | |
143 // on. | |
144 GURL page_url; | |
145 | |
146 // This is the URL of the subframe that the context menu was invoked on. | |
147 GURL frame_url; | |
148 }; | |
149 | |
150 struct AttachExternalTabParams { | |
151 AttachExternalTabParams(); | |
152 AttachExternalTabParams(uint64 cookie, | |
153 const GURL& url, | |
154 const gfx::Rect& dimensions, | |
155 int disposition, | |
156 bool user_gesture, | |
157 const std::string& profile_name); | |
158 ~AttachExternalTabParams(); | |
159 | |
160 uint64 cookie; | |
161 GURL url; | |
162 gfx::Rect dimensions; | |
163 int disposition; | |
164 bool user_gesture; | |
165 std::string profile_name; | |
166 }; | |
167 | |
168 #if defined(OS_WIN) | |
169 | |
170 struct Reposition_Params { | |
171 HWND window; | |
172 HWND window_insert_after; | |
173 int left; | |
174 int top; | |
175 int width; | |
176 int height; | |
177 int flags; | |
178 bool set_parent; | |
179 HWND parent_window; | |
180 }; | |
181 | |
182 #endif // defined(OS_WIN) | |
183 | |
184 struct AutomationURLRequest { | |
185 AutomationURLRequest(); | |
186 AutomationURLRequest(const std::string& url, | |
187 const std::string& method, | |
188 const std::string& referrer, | |
189 const std::string& extra_request_headers, | |
190 scoped_refptr<net::UploadData> upload_data, | |
191 int resource_type, | |
192 int load_flags); | |
193 ~AutomationURLRequest(); | |
194 | |
195 std::string url; | |
196 std::string method; | |
197 std::string referrer; | |
198 std::string extra_request_headers; | |
199 scoped_refptr<net::UploadData> upload_data; | |
200 int resource_type; // see webkit/glue/resource_type.h | |
201 int load_flags; // see net/base/load_flags.h | |
202 }; | |
203 | |
204 namespace IPC { | |
205 | |
206 template <> | |
207 struct ParamTraits<AutomationMsg_Find_Params> { | |
208 typedef AutomationMsg_Find_Params param_type; | |
209 static void Write(Message* m, const param_type& p); | |
210 static bool Read(const Message* m, void** iter, param_type* p); | |
211 static void Log(const param_type& p, std::string* l); | |
212 }; | |
213 | |
214 template <> | |
215 struct ParamTraits<AutomationMsg_NavigationResponseValues> { | |
216 typedef AutomationMsg_NavigationResponseValues param_type; | |
217 static void Write(Message* m, const param_type& p); | |
218 static bool Read(const Message* m, void** iter, param_type* p); | |
219 static void Log(const param_type& p, std::string* l); | |
220 }; | |
221 | |
222 template <> | |
223 struct ParamTraits<AutomationMsg_ExtensionResponseValues> { | |
224 typedef AutomationMsg_ExtensionResponseValues param_type; | |
225 static void Write(Message* m, const param_type& p); | |
226 static bool Read(const Message* m, void** iter, param_type* p); | |
227 static void Log(const param_type& p, std::string* l); | |
228 }; | |
229 | |
230 template <> | |
231 struct ParamTraits<AutomationMsg_ExtensionProperty> { | |
232 typedef AutomationMsg_ExtensionProperty param_type; | |
233 static void Write(Message* m, const param_type& p); | |
234 static bool Read(const Message* m, void** iter, param_type* p); | |
235 static void Log(const param_type& p, std::string* l); | |
236 }; | |
237 | |
238 template <> | |
239 struct ParamTraits<SecurityStyle> { | |
240 typedef SecurityStyle param_type; | |
241 static void Write(Message* m, const param_type& p); | |
242 static bool Read(const Message* m, void** iter, param_type* p); | |
243 static void Log(const param_type& p, std::string* l); | |
244 }; | |
245 | |
246 template <> | |
247 struct ParamTraits<PageType> { | |
248 typedef PageType param_type; | |
249 static void Write(Message* m, const param_type& p); | |
250 static bool Read(const Message* m, void** iter, param_type* p); | |
251 static void Log(const param_type& p, std::string* l); | |
252 }; | |
253 | |
254 #if defined(OS_WIN) | |
255 | |
256 // Traits for SetWindowPos_Params structure to pack/unpack. | |
257 template <> | |
258 struct ParamTraits<Reposition_Params> { | |
259 typedef Reposition_Params param_type; | |
260 static void Write(Message* m, const param_type& p) { | |
261 WriteParam(m, p.window); | |
262 WriteParam(m, p.window_insert_after); | |
263 WriteParam(m, p.left); | |
264 WriteParam(m, p.top); | |
265 WriteParam(m, p.width); | |
266 WriteParam(m, p.height); | |
267 WriteParam(m, p.flags); | |
268 WriteParam(m, p.set_parent); | |
269 WriteParam(m, p.parent_window); | |
270 } | |
271 static bool Read(const Message* m, void** iter, param_type* p) { | |
272 return ReadParam(m, iter, &p->window) && | |
273 ReadParam(m, iter, &p->window_insert_after) && | |
274 ReadParam(m, iter, &p->left) && | |
275 ReadParam(m, iter, &p->top) && | |
276 ReadParam(m, iter, &p->width) && | |
277 ReadParam(m, iter, &p->height) && | |
278 ReadParam(m, iter, &p->flags) && | |
279 ReadParam(m, iter, &p->set_parent) && | |
280 ReadParam(m, iter, &p->parent_window); | |
281 } | |
282 static void Log(const param_type& p, std::string* l) { | |
283 l->append("("); | |
284 LogParam(p.window, l); | |
285 l->append(", "); | |
286 LogParam(p.window_insert_after, l); | |
287 l->append(", "); | |
288 LogParam(p.left, l); | |
289 l->append(", "); | |
290 LogParam(p.top, l); | |
291 l->append(", "); | |
292 LogParam(p.width, l); | |
293 l->append(", "); | |
294 LogParam(p.height, l); | |
295 l->append(", "); | |
296 LogParam(p.flags, l); | |
297 l->append(", "); | |
298 LogParam(p.set_parent, l); | |
299 l->append(", "); | |
300 LogParam(p.parent_window, l); | |
301 l->append(")"); | |
302 } | |
303 }; | |
304 #endif // defined(OS_WIN) | |
305 | |
306 // Traits for AutomationURLRequest structure to pack/unpack. | |
307 template <> | |
308 struct ParamTraits<AutomationURLRequest> { | |
309 typedef AutomationURLRequest param_type; | |
310 static void Write(Message* m, const param_type& p); | |
311 static bool Read(const Message* m, void** iter, param_type* p); | |
312 static void Log(const param_type& p, std::string* l); | |
313 }; | |
314 | |
315 // Traits for AutomationURLResponse structure to pack/unpack. | |
316 template <> | |
317 struct ParamTraits<AutomationURLResponse> { | |
318 typedef AutomationURLResponse param_type; | |
319 static void Write(Message* m, const param_type& p); | |
320 static bool Read(const Message* m, void** iter, param_type* p); | |
321 static void Log(const param_type& p, std::string* l); | |
322 }; | |
323 | |
324 // Traits for ExternalTabSettings structure to pack/unpack. | |
325 template <> | |
326 struct ParamTraits<ExternalTabSettings> { | |
327 typedef ExternalTabSettings param_type; | |
328 static void Write(Message* m, const param_type& p); | |
329 static bool Read(const Message* m, void** iter, param_type* p); | |
330 static void Log(const param_type& p, std::string* l); | |
331 }; | |
332 | |
333 // Traits for NavigationInfo structure to pack/unpack. | |
334 template <> | |
335 struct ParamTraits<NavigationInfo> { | |
336 typedef NavigationInfo param_type; | |
337 static void Write(Message* m, const param_type& p); | |
338 static bool Read(const Message* m, void** iter, param_type* p); | |
339 static void Log(const param_type& p, std::string* l); | |
340 }; | |
341 | |
342 // Traits for MiniContextMenuParams structure to pack/unpack. | |
343 template <> | |
344 struct ParamTraits<MiniContextMenuParams> { | |
345 typedef MiniContextMenuParams param_type; | |
346 static void Write(Message* m, const param_type& p); | |
347 static bool Read(const Message* m, void** iter, param_type* p); | |
348 static void Log(const param_type& p, std::string* l); | |
349 }; | |
350 | |
351 template <> | |
352 struct ParamTraits<AttachExternalTabParams> { | |
353 typedef AttachExternalTabParams param_type; | |
354 static void Write(Message* m, const param_type& p); | |
355 static bool Read(const Message* m, void** iter, param_type* p); | |
356 static void Log(const param_type& p, std::string* l); | |
357 }; | |
358 | |
359 } // namespace IPC | |
360 | |
361 #endif // CHROME_COMMON_AUTOMATION_MESSAGES_H__ | |
362 | 7 |
363 // Keep this internal message file unchanged to preserve line numbering | 8 // Keep this internal message file unchanged to preserve line numbering |
364 // (and hence the dubious __LINE__-based message numberings) across versions. | 9 // (and hence the dubious __LINE__-based message numberings) across versions. |
365 #include "chrome/common/automation_messages_internal.h" | 10 #include "chrome/common/automation_messages_internal.h" |
366 | |
OLD | NEW |