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