OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Multiply-included message file, hence no include guard. | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/time.h" | |
10 #include "components/autofill/common/autocheckout_status.h" | |
11 #include "components/autofill/common/form_data.h" | |
12 #include "components/autofill/common/form_data_predictions.h" | |
13 #include "components/autofill/common/form_field_data.h" | |
14 #include "components/autofill/common/form_field_data_predictions.h" | |
15 #include "components/autofill/common/forms_seen_state.h" | |
16 #include "components/autofill/common/password_form_fill_data.h" | |
17 #include "components/autofill/common/web_element_descriptor.h" | |
18 #include "content/public/common/common_param_traits.h" | |
19 #include "content/public/common/common_param_traits_macros.h" | |
20 #include "content/public/common/password_form.h" | |
21 #include "content/public/common/ssl_status.h" | |
22 #include "googleurl/src/gurl.h" | |
23 #include "ipc/ipc_message_macros.h" | |
24 #include "ipc/ipc_message_utils.h" | |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | |
26 #include "ui/gfx/rect.h" | |
27 | |
28 #define IPC_MESSAGE_START AutofillMsgStart | |
29 | |
30 IPC_ENUM_TRAITS_MAX_VALUE(autofill::AutocheckoutStatus, | |
31 autofill::AUTOCHECKOUT_STATUS_NUM_STATUS - 1) | |
32 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormsSeenState, | |
33 autofill::FORMS_SEEN_STATE_NUM_STATES - 1) | |
34 IPC_ENUM_TRAITS_MAX_VALUE(base::i18n::TextDirection, | |
35 base::i18n::TEXT_DIRECTION_NUM_DIRECTIONS - 1) | |
36 | |
37 IPC_STRUCT_TRAITS_BEGIN(autofill::WebElementDescriptor) | |
38 IPC_STRUCT_TRAITS_MEMBER(descriptor) | |
39 IPC_STRUCT_TRAITS_MEMBER(retrieval_method) | |
40 IPC_STRUCT_TRAITS_END() | |
41 | |
42 IPC_ENUM_TRAITS(autofill::WebElementDescriptor::RetrievalMethod) | |
43 | |
44 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldData) | |
45 IPC_STRUCT_TRAITS_MEMBER(label) | |
46 IPC_STRUCT_TRAITS_MEMBER(name) | |
47 IPC_STRUCT_TRAITS_MEMBER(value) | |
48 IPC_STRUCT_TRAITS_MEMBER(form_control_type) | |
49 IPC_STRUCT_TRAITS_MEMBER(autocomplete_attribute) | |
50 IPC_STRUCT_TRAITS_MEMBER(max_length) | |
51 IPC_STRUCT_TRAITS_MEMBER(is_autofilled) | |
52 IPC_STRUCT_TRAITS_MEMBER(is_checked) | |
53 IPC_STRUCT_TRAITS_MEMBER(is_checkable) | |
54 IPC_STRUCT_TRAITS_MEMBER(is_focusable) | |
55 IPC_STRUCT_TRAITS_MEMBER(should_autocomplete) | |
56 IPC_STRUCT_TRAITS_MEMBER(text_direction) | |
57 IPC_STRUCT_TRAITS_MEMBER(option_values) | |
58 IPC_STRUCT_TRAITS_MEMBER(option_contents) | |
59 IPC_STRUCT_TRAITS_END() | |
60 | |
61 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldDataPredictions) | |
62 IPC_STRUCT_TRAITS_MEMBER(field) | |
63 IPC_STRUCT_TRAITS_MEMBER(signature) | |
64 IPC_STRUCT_TRAITS_MEMBER(heuristic_type) | |
65 IPC_STRUCT_TRAITS_MEMBER(server_type) | |
66 IPC_STRUCT_TRAITS_MEMBER(overall_type) | |
67 IPC_STRUCT_TRAITS_END() | |
68 | |
69 IPC_STRUCT_TRAITS_BEGIN(autofill::FormData) | |
70 IPC_STRUCT_TRAITS_MEMBER(name) | |
71 IPC_STRUCT_TRAITS_MEMBER(method) | |
72 IPC_STRUCT_TRAITS_MEMBER(origin) | |
73 IPC_STRUCT_TRAITS_MEMBER(action) | |
74 IPC_STRUCT_TRAITS_MEMBER(user_submitted) | |
75 IPC_STRUCT_TRAITS_MEMBER(fields) | |
76 IPC_STRUCT_TRAITS_END() | |
77 | |
78 IPC_STRUCT_TRAITS_BEGIN(autofill::FormDataPredictions) | |
79 IPC_STRUCT_TRAITS_MEMBER(data) | |
80 IPC_STRUCT_TRAITS_MEMBER(signature) | |
81 IPC_STRUCT_TRAITS_MEMBER(experiment_id) | |
82 IPC_STRUCT_TRAITS_MEMBER(fields) | |
83 IPC_STRUCT_TRAITS_END() | |
84 | |
85 IPC_STRUCT_TRAITS_BEGIN(autofill::UsernamesCollectionKey) | |
86 IPC_STRUCT_TRAITS_MEMBER(username) | |
87 IPC_STRUCT_TRAITS_MEMBER(password) | |
88 IPC_STRUCT_TRAITS_END() | |
89 | |
90 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordFormFillData) | |
91 IPC_STRUCT_TRAITS_MEMBER(basic_data) | |
92 IPC_STRUCT_TRAITS_MEMBER(additional_logins) | |
93 IPC_STRUCT_TRAITS_MEMBER(other_possible_usernames) | |
94 IPC_STRUCT_TRAITS_MEMBER(wait_for_username) | |
95 IPC_STRUCT_TRAITS_END() | |
96 | |
97 IPC_ENUM_TRAITS(WebKit::WebFormElement::AutocompleteResult) | |
98 | |
99 // Autofill messages sent from the browser to the renderer. | |
100 | |
101 // Request to parse all the forms without field count limit. | |
102 IPC_MESSAGE_ROUTED0(AutofillMsg_GetAllForms) | |
103 | |
104 // Reply to the AutofillHostMsg_QueryFormFieldAutofill message with the | |
105 // Autofill suggestions. | |
106 IPC_MESSAGE_ROUTED5(AutofillMsg_SuggestionsReturned, | |
107 int /* id of the request message */, | |
108 std::vector<base::string16> /* names */, | |
109 std::vector<base::string16> /* labels */, | |
110 std::vector<base::string16> /* icons */, | |
111 std::vector<int> /* unique_ids */) | |
112 | |
113 // Reply to the AutofillHostMsg_FillAutofillFormData message with the | |
114 // Autofill form data. | |
115 IPC_MESSAGE_ROUTED2(AutofillMsg_FormDataFilled, | |
116 int /* id of the request message */, | |
117 autofill::FormData /* form data */) | |
118 | |
119 // Fill a password form and prepare field autocomplete for multiple | |
120 // matching logins. Lets the renderer know if it should disable the popup | |
121 // because the browser process will own the popup UI. | |
122 IPC_MESSAGE_ROUTED2(AutofillMsg_FillPasswordForm, | |
123 autofill::PasswordFormFillData, /* the fill form data*/ | |
124 bool /* disable popup */ ) | |
125 | |
126 // Send the heuristic and server field type predictions to the renderer. | |
127 IPC_MESSAGE_ROUTED1( | |
128 AutofillMsg_FieldTypePredictionsAvailable, | |
129 std::vector<autofill::FormDataPredictions> /* forms */) | |
130 | |
131 // Tells the renderer that the next form will be filled for real. | |
132 IPC_MESSAGE_ROUTED0(AutofillMsg_SetAutofillActionFill) | |
133 | |
134 // Clears the currently displayed Autofill results. | |
135 IPC_MESSAGE_ROUTED0(AutofillMsg_ClearForm) | |
136 | |
137 // Tells the renderer that the next form will be filled as a preview. | |
138 IPC_MESSAGE_ROUTED0(AutofillMsg_SetAutofillActionPreview) | |
139 | |
140 // Tells the renderer that the Autofill previewed form should be cleared. | |
141 IPC_MESSAGE_ROUTED0(AutofillMsg_ClearPreviewedForm) | |
142 | |
143 // Sets the currently selected node's value. | |
144 IPC_MESSAGE_ROUTED1(AutofillMsg_SetNodeText, | |
145 base::string16 /* new node text */) | |
146 | |
147 // Sets the currently selected node's value to be the given data list value. | |
148 IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptDataListSuggestion, | |
149 base::string16 /* accepted data list value */) | |
150 | |
151 // Tells the renderer to populate the correct password fields with this | |
152 // generated password. | |
153 IPC_MESSAGE_ROUTED1(AutofillMsg_GeneratedPasswordAccepted, | |
154 base::string16 /* generated_password */) | |
155 | |
156 // Tells the renderer whether password generation is enabled. | |
157 IPC_MESSAGE_ROUTED1(AutofillMsg_PasswordGenerationEnabled, | |
158 bool /* is_enabled */) | |
159 | |
160 // Tells the renderer that the password field has accept the suggestion. | |
161 IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptPasswordAutofillSuggestion, | |
162 base::string16 /* username value*/) | |
163 | |
164 // Tells the renderer that this password form is not blacklisted. A form can | |
165 // be blacklisted if a user chooses "never save passwords for this site". | |
166 IPC_MESSAGE_ROUTED1(AutofillMsg_FormNotBlacklisted, | |
167 content::PasswordForm /* form checked */) | |
168 | |
169 // Sent when requestAutocomplete() finishes (either succesfully or with an | |
170 // error). If it was a success, the renderer fills the form that requested | |
171 // autocomplete with the |form_data| values input by the user. | |
172 IPC_MESSAGE_ROUTED2(AutofillMsg_RequestAutocompleteResult, | |
173 WebKit::WebFormElement::AutocompleteResult /* result */, | |
174 autofill::FormData /* form_data */) | |
175 | |
176 // Sent when a page should be filled using Autocheckout. This happens when the | |
177 // Autofill server hints that a page is Autocheckout enabled. | |
178 IPC_MESSAGE_ROUTED4(AutofillMsg_FillFormsAndClick, | |
179 std::vector<autofill::FormData> /* form_data */, | |
180 std::vector<autofill::WebElementDescriptor> /* | |
181 click_elements_before_form_fill */, | |
182 std::vector<autofill::WebElementDescriptor> /* | |
183 click_elements_after_form_fill */, | |
184 autofill::WebElementDescriptor /* element_descriptor */) | |
185 | |
186 // Sent when Autocheckout is supported for the current page. The page has to | |
187 // be whitelisted and the Autofill server must have returned Autocheckout page | |
188 // metadata. | |
189 IPC_MESSAGE_ROUTED0(AutofillMsg_AutocheckoutSupported) | |
190 | |
191 // Autofill messages sent from the renderer to the browser. | |
192 | |
193 // TODO(creis): check in the browser that the renderer actually has permission | |
194 // for the URL to avoid compromised renderers talking to the browser. | |
195 | |
196 // Notification that forms have been seen that are candidates for | |
197 // filling/submitting by the AutofillManager. | |
198 IPC_MESSAGE_ROUTED3(AutofillHostMsg_FormsSeen, | |
199 std::vector<autofill::FormData> /* forms */, | |
200 base::TimeTicks /* timestamp */, | |
201 autofill::FormsSeenState /* state */) | |
202 | |
203 // Notification that password forms have been seen that are candidates for | |
204 // filling/submitting by the password manager. | |
205 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsParsed, | |
206 std::vector<content::PasswordForm> /* forms */) | |
207 | |
208 // Notification that initial layout has occurred and the following password | |
209 // forms are visible on the page (e.g. not set to display:none.) | |
210 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsRendered, | |
211 std::vector<content::PasswordForm> /* forms */) | |
212 | |
213 // Notification that a form has been submitted. The user hit the button. | |
214 IPC_MESSAGE_ROUTED2(AutofillHostMsg_FormSubmitted, | |
215 autofill::FormData /* form */, | |
216 base::TimeTicks /* timestamp */) | |
217 | |
218 // Notification that a form field's value has changed. | |
219 IPC_MESSAGE_ROUTED3(AutofillHostMsg_TextFieldDidChange, | |
220 autofill::FormData /* the form */, | |
221 autofill::FormFieldData /* the form field */, | |
222 base::TimeTicks /* timestamp */) | |
223 | |
224 // Shows the Autocheckout bubble if the conditions are right. | |
225 IPC_MESSAGE_ROUTED2(AutofillHostMsg_MaybeShowAutocheckoutBubble, | |
226 autofill::FormData /* form */, | |
227 gfx::RectF /* bounding_box */) | |
228 | |
229 // Queries the browser for Autofill suggestions for a form input field. | |
230 IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill, | |
231 int /* id of this message */, | |
232 autofill::FormData /* the form */, | |
233 autofill::FormFieldData /* the form field */, | |
234 gfx::RectF /* input field bounds, window-relative */, | |
235 bool /* display warning if autofill disabled */) | |
236 | |
237 // Sent when the popup with Autofill suggestions for a form is shown. | |
238 IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidShowAutofillSuggestions, | |
239 bool /* is this a new popup? */) | |
240 | |
241 // Instructs the browser to fill in the values for a form using Autofill | |
242 // profile data. | |
243 IPC_MESSAGE_ROUTED4(AutofillHostMsg_FillAutofillFormData, | |
244 int /* id of this message */, | |
245 autofill::FormData /* the form */, | |
246 autofill::FormFieldData /* the form field */, | |
247 int /* profile unique ID */) | |
248 | |
249 // Sent when a form is previewed with Autofill suggestions. | |
250 IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidPreviewAutofillFormData) | |
251 | |
252 // Sent when a form is filled with Autofill suggestions. | |
253 IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidFillAutofillFormData, | |
254 base::TimeTicks /* timestamp */) | |
255 | |
256 // Sent when a form receives a request to do interactive autocomplete. | |
257 IPC_MESSAGE_ROUTED2(AutofillHostMsg_RequestAutocomplete, | |
258 autofill::FormData /* form_data */, | |
259 GURL /* frame_url */) | |
260 | |
261 // Instructs the browser to remove the specified Autocomplete entry from the | |
262 // database. | |
263 IPC_MESSAGE_ROUTED2(AutofillHostMsg_RemoveAutocompleteEntry, | |
264 base::string16 /* field name */, | |
265 base::string16 /* value */) | |
266 | |
267 // Instructs the browser to show the Autofill dialog. | |
268 IPC_MESSAGE_ROUTED0(AutofillHostMsg_ShowAutofillDialog) | |
269 | |
270 // Send when a text field is done editing. | |
271 IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidEndTextFieldEditing) | |
272 | |
273 // Instructs the browser to hide the Autofill UI. | |
274 IPC_MESSAGE_ROUTED0(AutofillHostMsg_HideAutofillUi) | |
275 | |
276 // Sent when the renderer attempts to click an element in an Autocheckout flow | |
277 // and either the element could not be found or the click did not have the | |
278 // desired effect. | |
279 IPC_MESSAGE_ROUTED1(AutofillHostMsg_ClickFailed, | |
280 autofill::AutocheckoutStatus /* status */) | |
281 | |
282 // Instructs the browser to show the password generation bubble at the | |
283 // specified location. This location should be specified in the renderers | |
284 // coordinate system. Form is the form associated with the password field. | |
285 IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordGenerationPopup, | |
286 gfx::Rect /* source location */, | |
287 int /* max length of the password */, | |
288 content::PasswordForm) | |
289 | |
290 // Instruct the browser that a password mapping has been found for a field. | |
291 IPC_MESSAGE_ROUTED2(AutofillHostMsg_AddPasswordFormMapping, | |
292 autofill::FormFieldData, /* the user name field */ | |
293 autofill::PasswordFormFillData /* password pairings */) | |
294 | |
295 // Instruct the browser to show a popup with the following suggestions from the | |
296 // password manager. | |
297 IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordSuggestions, | |
298 autofill::FormFieldData /* the form field */, | |
299 gfx::RectF /* input field bounds, window-relative */, | |
300 std::vector<base::string16> /* suggestions */) | |
301 | |
302 // Inform browser of data list values for the curent field. | |
303 IPC_MESSAGE_ROUTED4(AutofillHostMsg_SetDataList, | |
304 std::vector<base::string16> /* values */, | |
305 std::vector<base::string16> /* labels */, | |
306 std::vector<base::string16> /* icons */, | |
307 std::vector<int> /* unique ids */) | |
OLD | NEW |