summaryrefslogtreecommitdiffstats
path: root/chrome/common/automation_messages.h
blob: c01b93a6fc3525cafb6a123f86bd51f0f607c832 (plain)
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
// Copyright (c) 2012 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.

// Multiply-included message file, no traditional include guard.
#include <string>
#include <vector>

#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/common_param_traits.h"
#include "chrome/common/content_settings.h"
#include "content/public/common/common_param_traits.h"
#include "content/public/common/page_type.h"
#include "content/public/common/security_style.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "net/base/host_port_pair.h"
#include "net/base/upload_data.h"
#include "net/cert/cert_status_flags.h"
#include "net/url_request/url_request_status.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/rect.h"
#include "url/gurl.h"

IPC_ENUM_TRAITS(AutomationMsg_NavigationResponseValues)
IPC_ENUM_TRAITS(content::PageType)

IPC_STRUCT_BEGIN(AutomationMsg_Find_Params)
  // The word(s) to find on the page.
  IPC_STRUCT_MEMBER(string16, search_string)

  // Whether to search forward or backward within the page.
  IPC_STRUCT_MEMBER(bool, forward)

  // Whether search should be Case sensitive.
  IPC_STRUCT_MEMBER(bool, match_case)

  // Whether this operation is first request (Find) or a follow-up (FindNext).
  IPC_STRUCT_MEMBER(bool, find_next)
IPC_STRUCT_END()

IPC_STRUCT_BEGIN(AutomationURLResponse)
  IPC_STRUCT_MEMBER(std::string, mime_type)
  IPC_STRUCT_MEMBER(std::string, headers)
  IPC_STRUCT_MEMBER(int64, content_length)
  IPC_STRUCT_MEMBER(base::Time, last_modified)
  IPC_STRUCT_MEMBER(std::string, redirect_url)
  IPC_STRUCT_MEMBER(int, redirect_status)
  IPC_STRUCT_MEMBER(net::HostPortPair, socket_address)
  IPC_STRUCT_MEMBER(uint64, upload_size)
IPC_STRUCT_END()

#if defined(OS_WIN)

IPC_STRUCT_BEGIN(ExternalTabSettings)
  IPC_STRUCT_MEMBER(HWND, parent)
  IPC_STRUCT_MEMBER(gfx::Rect, dimensions)
  IPC_STRUCT_MEMBER(unsigned int, style)
  IPC_STRUCT_MEMBER(bool, is_incognito)
  IPC_STRUCT_MEMBER(bool, load_requests_via_automation)
  IPC_STRUCT_MEMBER(bool, handle_top_level_requests)
  IPC_STRUCT_MEMBER(GURL, initial_url)
  IPC_STRUCT_MEMBER(GURL, referrer)
  IPC_STRUCT_MEMBER(bool, infobars_enabled)
  IPC_STRUCT_MEMBER(bool, route_all_top_level_navigations)
IPC_STRUCT_END()

#endif  // defined(OS_WIN)

IPC_STRUCT_BEGIN(NavigationInfo)
  IPC_STRUCT_MEMBER(int, navigation_type)
  IPC_STRUCT_MEMBER(int, relative_offset)
  IPC_STRUCT_MEMBER(int, navigation_index)
  IPC_STRUCT_MEMBER(std::wstring, title)
  IPC_STRUCT_MEMBER(GURL, url)
  IPC_STRUCT_MEMBER(GURL, referrer)
  IPC_STRUCT_MEMBER(content::SecurityStyle, security_style)
  IPC_STRUCT_MEMBER(bool, displayed_insecure_content)
  IPC_STRUCT_MEMBER(bool, ran_insecure_content)
IPC_STRUCT_END()

// A stripped down version of ContextMenuParams.
IPC_STRUCT_BEGIN(MiniContextMenuParams)
  // The x coordinate for displaying the menu.
  IPC_STRUCT_MEMBER(int, screen_x)

  // The y coordinate for displaying the menu.
  IPC_STRUCT_MEMBER(int, screen_y)

  // This is the URL of the link that encloses the node the context menu was
  // invoked on.
  IPC_STRUCT_MEMBER(GURL, link_url)

  // The link URL to be used ONLY for "copy link address". We don't validate
  // this field in the frontend process.
  IPC_STRUCT_MEMBER(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.
  IPC_STRUCT_MEMBER(GURL, src_url)

  // This is the URL of the top level page that the context menu was invoked
  // on.
  IPC_STRUCT_MEMBER(GURL, page_url)

  // This is the absolute keyword search URL including the %s search tag when
  // the "Add as search engine..." option is clicked (left empty if not used).
  IPC_STRUCT_MEMBER(GURL, keyword_url)

  // This is the URL of the subframe that the context menu was invoked on.
  IPC_STRUCT_MEMBER(GURL, frame_url)
IPC_STRUCT_END()

IPC_STRUCT_BEGIN(AttachExternalTabParams)
  IPC_STRUCT_MEMBER(uint64, cookie)
  IPC_STRUCT_MEMBER(GURL, url)
  IPC_STRUCT_MEMBER(gfx::Rect, dimensions)
  IPC_STRUCT_MEMBER(int, disposition)
  IPC_STRUCT_MEMBER(bool, user_gesture)
  IPC_STRUCT_MEMBER(std::string, profile_name)
IPC_STRUCT_END()

#if defined(OS_WIN)

IPC_STRUCT_BEGIN(Reposition_Params)
  IPC_STRUCT_MEMBER(HWND, window)
  IPC_STRUCT_MEMBER(HWND, window_insert_after)
  IPC_STRUCT_MEMBER(int, left)
  IPC_STRUCT_MEMBER(int, top)
  IPC_STRUCT_MEMBER(int, width)
  IPC_STRUCT_MEMBER(int, height)
  IPC_STRUCT_MEMBER(int, flags)
  IPC_STRUCT_MEMBER(bool, set_parent)
  IPC_STRUCT_MEMBER(HWND, parent_window)
IPC_STRUCT_END()

#endif  // defined(OS_WIN)

IPC_STRUCT_BEGIN(AutomationURLRequest)
  IPC_STRUCT_MEMBER(std::string, url)
  IPC_STRUCT_MEMBER(std::string, method)
  IPC_STRUCT_MEMBER(std::string, referrer)
  IPC_STRUCT_MEMBER(std::string, extra_request_headers)
  IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data)
  IPC_STRUCT_MEMBER(int, resource_type)  // see webkit/common/resource_type.h
  IPC_STRUCT_MEMBER(int, load_flags) // see net/base/load_flags.h
IPC_STRUCT_END()

// Singly-included section for struct and custom IPC traits.
#ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H_
#define CHROME_COMMON_AUTOMATION_MESSAGES_H_

// This struct passes information about the context menu in Chrome stored
// as a ui::MenuModel to Chrome Frame.  It is basically a container of
// items that go in the menu.  An item may be a submenu, so the data
// structure may be a tree.
struct ContextMenuModel {
  ContextMenuModel();
  ~ContextMenuModel();

  // This struct describes one item in the menu.
  struct Item {
    Item();

    // This is the type of the menu item, using values from the enum
    // ui::MenuModel::ItemType (serialized as an int).
    int type;

    // This is the command id of the menu item, which will be passed by
    // Chrome Frame to Chrome if the item is selected.
    int item_id;

    // This the the menu label, if needed.
    std::wstring label;

    // These are states of the menu item.
    bool checked;
    bool enabled;

    // This recursively describes the submenu if type is
    // ui::MenuModel::TYPE_SUBMENU.
    ContextMenuModel* submenu;
  };

  // This is the list of menu items.
  std::vector<Item> items;
};

namespace IPC {

template <>
struct ParamTraits<ContextMenuModel> {
  typedef ContextMenuModel param_type;
  static void Write(Message* m, const param_type& p);
  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
  static void Log(const param_type& p, std::string* l);
};

template <>
struct ParamTraits<scoped_refptr<net::UploadData> > {
  typedef scoped_refptr<net::UploadData> param_type;
  static void Write(Message* m, const param_type& p);
  static bool Read(const Message* m, PickleIterator* iter, param_type* r);
  static void Log(const param_type& p, std::string* l);
};

template <>
struct ParamTraits<net::URLRequestStatus> {
  typedef net::URLRequestStatus param_type;
  static void Write(Message* m, const param_type& p);
  static bool Read(const Message* m, PickleIterator* iter, param_type* r);
  static void Log(const param_type& p, std::string* l);
};

}  // namespace IPC

#endif  // CHROME_COMMON_AUTOMATION_MESSAGES_H_

// Keep this internal message file unchanged to preserve line numbering
// (and hence the dubious __LINE__-based message numberings) across versions.
#include "chrome/common/automation_messages_internal.h"