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
|
// Copyright (c) 2006-2008 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_TEST_AUTOMATION_AUTOMATION_MESSAGES_H__
#define CHROME_TEST_AUTOMATION_AUTOMATION_MESSAGES_H__
#include <string>
#include "base/basictypes.h"
#include "base/gfx/rect.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/security_style.h"
#include "chrome/common/ipc_message_utils.h"
#include "chrome/test/automation/automation_constants.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;
};
namespace IPC {
template <>
struct ParamTraits<AutomationMsg_Find_Params> {
typedef AutomationMsg_Find_Params param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.unused);
WriteParam(m, p.search_string);
WriteParam(m, p.forward);
WriteParam(m, p.match_case);
WriteParam(m, p.find_next);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->unused) &&
ReadParam(m, iter, &p->search_string) &&
ReadParam(m, iter, &p->forward) &&
ReadParam(m, iter, &p->match_case) &&
ReadParam(m, iter, &p->find_next);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"<AutomationMsg_Find_Params>");
}
};
template <>
struct ParamTraits<AutomationMsg_NavigationResponseValues> {
typedef AutomationMsg_NavigationResponseValues param_type;
static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
*p = static_cast<AutomationMsg_NavigationResponseValues>(type);
return true;
}
static void Log(const param_type& p, std::wstring* l) {
std::wstring control;
switch (p) {
case AUTOMATION_MSG_NAVIGATION_ERROR:
control = L"AUTOMATION_MSG_NAVIGATION_ERROR";
break;
case AUTOMATION_MSG_NAVIGATION_SUCCESS:
control = L"AUTOMATION_MSG_NAVIGATION_SUCCESS";
break;
case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED:
control = L"AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED";
break;
default:
control = L"UNKNOWN";
break;
}
LogParam(control, l);
}
};
template <>
struct ParamTraits<SecurityStyle> {
typedef SecurityStyle param_type;
static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
*p = static_cast<SecurityStyle>(type);
return true;
}
static void Log(const param_type& p, std::wstring* l) {
std::wstring control;
switch (p) {
case SECURITY_STYLE_UNKNOWN:
control = L"SECURITY_STYLE_UNKNOWN";
break;
case SECURITY_STYLE_UNAUTHENTICATED:
control = L"SECURITY_STYLE_UNAUTHENTICATED";
break;
case SECURITY_STYLE_AUTHENTICATION_BROKEN:
control = L"SECURITY_STYLE_AUTHENTICATION_BROKEN";
break;
case SECURITY_STYLE_AUTHENTICATED:
control = L"SECURITY_STYLE_AUTHENTICATED";
break;
default:
control = L"UNKNOWN";
break;
}
LogParam(control, l);
}
};
template <>
struct ParamTraits<NavigationEntry::PageType> {
typedef NavigationEntry::PageType param_type;
static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
*p = static_cast<NavigationEntry::PageType>(type);
return true;
}
static void Log(const param_type& p, std::wstring* l) {
std::wstring control;
switch (p) {
case NavigationEntry::NORMAL_PAGE:
control = L"NORMAL_PAGE";
break;
case NavigationEntry::ERROR_PAGE:
control = L"ERROR_PAGE";
break;
case NavigationEntry::INTERSTITIAL_PAGE:
control = L"INTERSTITIAL_PAGE";
break;
default:
control = L"UNKNOWN";
break;
}
LogParam(control, l);
}
};
#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;
};
// 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::wstring* l) {
l->append(L"(");
LogParam(p.window, l);
l->append(L", ");
LogParam(p.window_insert_after, l);
l->append(L", ");
LogParam(p.left, l);
l->append(L", ");
LogParam(p.top, l);
l->append(L", ");
LogParam(p.width, l);
l->append(L", ");
LogParam(p.height, l);
l->append(L", ");
LogParam(p.flags, l);
l->append(L", ");
LogParam(p.set_parent, l);
l->append(L", ");
LogParam(p.parent_window, l);
l->append(L")");
}
};
#endif // defined(OS_WIN)
struct AutomationURLRequest {
std::string url;
std::string method;
std::string referrer;
std::string extra_request_headers;
};
// Traits for AutomationURLRequest structure to pack/unpack.
template <>
struct ParamTraits<AutomationURLRequest> {
typedef AutomationURLRequest param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.url);
WriteParam(m, p.method);
WriteParam(m, p.referrer);
WriteParam(m, p.extra_request_headers);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->method) &&
ReadParam(m, iter, &p->referrer) &&
ReadParam(m, iter, &p->extra_request_headers);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
LogParam(p.url, l);
l->append(L", ");
LogParam(p.method, l);
l->append(L", ");
LogParam(p.referrer, l);
l->append(L", ");
LogParam(p.extra_request_headers, l);
l->append(L")");
}
};
struct AutomationURLResponse {
std::string mime_type;
std::string headers;
int64 content_length;
base::Time last_modified;
};
// Traits for AutomationURLRequest structure to pack/unpack.
template <>
struct ParamTraits<AutomationURLResponse> {
typedef AutomationURLResponse param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.mime_type);
WriteParam(m, p.headers);
WriteParam(m, p.content_length);
WriteParam(m, p.last_modified);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->mime_type) &&
ReadParam(m, iter, &p->headers) &&
ReadParam(m, iter, &p->content_length) &&
ReadParam(m, iter, &p->last_modified);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
LogParam(p.mime_type, l);
l->append(L", ");
LogParam(p.headers, l);
l->append(L", ");
LogParam(p.content_length, l);
l->append(L", ");
LogParam(p.last_modified, l);
l->append(L")");
}
};
struct ExternalTabSettings {
gfx::NativeWindow parent;
gfx::Rect dimensions;
unsigned int style;
bool is_off_the_record;
bool load_requests_via_automation;
};
// Traits for ExternalTabSettings structure to pack/unpack.
template <>
struct ParamTraits<ExternalTabSettings> {
typedef ExternalTabSettings param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.parent);
WriteParam(m, p.dimensions);
WriteParam(m, p.style);
WriteParam(m, p.is_off_the_record);
WriteParam(m, p.load_requests_via_automation);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->parent) &&
ReadParam(m, iter, &p->dimensions) &&
ReadParam(m, iter, &p->style) &&
ReadParam(m, iter, &p->is_off_the_record) &&
ReadParam(m, iter, &p->load_requests_via_automation);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
LogParam(p.parent, l);
l->append(L", ");
LogParam(p.dimensions, l);
l->append(L", ");
LogParam(p.style, l);
l->append(L", ");
LogParam(p.is_off_the_record, l);
l->append(L", ");
LogParam(p.load_requests_via_automation, l);
l->append(L")");
}
};
} // namespace IPC
#define MESSAGES_INTERNAL_FILE \
"chrome/test/automation/automation_messages_internal.h"
#include "chrome/common/ipc_message_macros.h"
#endif // CHROME_TEST_AUTOMATION_AUTOMATION_MESSAGES_H__
|