1 // Copyright 2013 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/time.h" 10 #include "components/autofill/content/common/autofill_param_traits_macros.h" 11 #include "components/autofill/core/common/form_data.h" 12 #include "components/autofill/core/common/form_data_predictions.h" 13 #include "components/autofill/core/common/form_field_data.h" 14 #include "components/autofill/core/common/form_field_data_predictions.h" 15 #include "components/autofill/core/common/forms_seen_state.h" 16 #include "components/autofill/core/common/password_form.h" 17 #include "components/autofill/core/common/password_form_fill_data.h" 18 #include "components/autofill/core/common/web_element_descriptor.h" 19 #include "content/public/common/common_param_traits.h" 20 #include "content/public/common/common_param_traits_macros.h" 21 #include "ipc/ipc_message_macros.h" 22 #include "ipc/ipc_message_utils.h" 23 #include "third_party/WebKit/public/web/WebFormElement.h" 24 #include "ui/gfx/rect.h" 25 26 #define IPC_MESSAGE_START AutofillMsgStart 27 28 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormsSeenState, 29 autofill::FORMS_SEEN_STATE_NUM_STATES - 1) 30 IPC_ENUM_TRAITS_MAX_VALUE(base::i18n::TextDirection, 31 base::i18n::TEXT_DIRECTION_NUM_DIRECTIONS - 1) 32 33 IPC_STRUCT_TRAITS_BEGIN(autofill::WebElementDescriptor) 34 IPC_STRUCT_TRAITS_MEMBER(descriptor) 35 IPC_STRUCT_TRAITS_MEMBER(retrieval_method) 36 IPC_STRUCT_TRAITS_END() 37 38 IPC_ENUM_TRAITS_MAX_VALUE(autofill::WebElementDescriptor::RetrievalMethod, 39 autofill::WebElementDescriptor::NONE) 40 41 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldData) 42 IPC_STRUCT_TRAITS_MEMBER(label) 43 IPC_STRUCT_TRAITS_MEMBER(name) 44 IPC_STRUCT_TRAITS_MEMBER(value) 45 IPC_STRUCT_TRAITS_MEMBER(form_control_type) 46 IPC_STRUCT_TRAITS_MEMBER(autocomplete_attribute) 47 IPC_STRUCT_TRAITS_MEMBER(max_length) 48 IPC_STRUCT_TRAITS_MEMBER(is_autofilled) 49 IPC_STRUCT_TRAITS_MEMBER(is_checked) 50 IPC_STRUCT_TRAITS_MEMBER(is_checkable) 51 IPC_STRUCT_TRAITS_MEMBER(is_focusable) 52 IPC_STRUCT_TRAITS_MEMBER(should_autocomplete) 53 IPC_STRUCT_TRAITS_MEMBER(text_direction) 54 IPC_STRUCT_TRAITS_MEMBER(option_values) 55 IPC_STRUCT_TRAITS_MEMBER(option_contents) 56 IPC_STRUCT_TRAITS_END() 57 58 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldDataPredictions) 59 IPC_STRUCT_TRAITS_MEMBER(field) 60 IPC_STRUCT_TRAITS_MEMBER(signature) 61 IPC_STRUCT_TRAITS_MEMBER(heuristic_type) 62 IPC_STRUCT_TRAITS_MEMBER(server_type) 63 IPC_STRUCT_TRAITS_MEMBER(overall_type) 64 IPC_STRUCT_TRAITS_END() 65 66 IPC_STRUCT_TRAITS_BEGIN(autofill::FormDataPredictions) 67 IPC_STRUCT_TRAITS_MEMBER(data) 68 IPC_STRUCT_TRAITS_MEMBER(signature) 69 IPC_STRUCT_TRAITS_MEMBER(experiment_id) 70 IPC_STRUCT_TRAITS_MEMBER(fields) 71 IPC_STRUCT_TRAITS_END() 72 73 IPC_STRUCT_TRAITS_BEGIN(autofill::UsernamesCollectionKey) 74 IPC_STRUCT_TRAITS_MEMBER(username) 75 IPC_STRUCT_TRAITS_MEMBER(password) 76 IPC_STRUCT_TRAITS_END() 77 78 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordFormFillData) 79 IPC_STRUCT_TRAITS_MEMBER(basic_data) 80 IPC_STRUCT_TRAITS_MEMBER(preferred_realm) 81 IPC_STRUCT_TRAITS_MEMBER(additional_logins) 82 IPC_STRUCT_TRAITS_MEMBER(other_possible_usernames) 83 IPC_STRUCT_TRAITS_MEMBER(wait_for_username) 84 IPC_STRUCT_TRAITS_END() 85 86 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordAndRealm) 87 IPC_STRUCT_TRAITS_MEMBER(password) 88 IPC_STRUCT_TRAITS_MEMBER(realm) 89 IPC_STRUCT_TRAITS_END() 90 91 IPC_ENUM_TRAITS_MAX_VALUE( 92 blink::WebFormElement::AutocompleteResult, 93 blink::WebFormElement::AutocompleteResultErrorInvalid) 94 95 // Autofill messages sent from the browser to the renderer. 96 97 // Reply to the AutofillHostMsg_FillAutofillFormData message with the 98 // Autofill form data. 99 IPC_MESSAGE_ROUTED2(AutofillMsg_FormDataFilled, 100 int /* id of the request message */, 101 autofill::FormData /* form data */) 102 103 // Fill a password form and prepare field autocomplete for multiple 104 // matching logins. Lets the renderer know if it should disable the popup 105 // because the browser process will own the popup UI. 106 IPC_MESSAGE_ROUTED1(AutofillMsg_FillPasswordForm, 107 autofill::PasswordFormFillData /* the fill form data*/) 108 109 // Send the heuristic and server field type predictions to the renderer. 110 IPC_MESSAGE_ROUTED1( 111 AutofillMsg_FieldTypePredictionsAvailable, 112 std::vector<autofill::FormDataPredictions> /* forms */) 113 114 // Tells the renderer that the next form will be filled for real. 115 IPC_MESSAGE_ROUTED0(AutofillMsg_SetAutofillActionFill) 116 117 // Clears the currently displayed Autofill results. 118 IPC_MESSAGE_ROUTED0(AutofillMsg_ClearForm) 119 120 // Tells the renderer that the next form will be filled as a preview. 121 IPC_MESSAGE_ROUTED0(AutofillMsg_SetAutofillActionPreview) 122 123 // Tells the renderer that the Autofill previewed form should be cleared. 124 IPC_MESSAGE_ROUTED0(AutofillMsg_ClearPreviewedForm) 125 126 // Sets the currently selected node's value. 127 IPC_MESSAGE_ROUTED1(AutofillMsg_SetNodeText, 128 base::string16 /* new node text */) 129 130 // Sets the currently selected node's value to be the given data list value. 131 IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptDataListSuggestion, 132 base::string16 /* accepted data list value */) 133 134 // Tells the renderer to populate the correct password fields with this 135 // generated password. 136 IPC_MESSAGE_ROUTED1(AutofillMsg_GeneratedPasswordAccepted, 137 base::string16 /* generated_password */) 138 139 // Tells the renderer that the password field has accept the suggestion. 140 IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptPasswordAutofillSuggestion, 141 base::string16 /* username value*/) 142 143 // Tells the renderer that this password form is not blacklisted. A form can 144 // be blacklisted if a user chooses "never save passwords for this site". 145 IPC_MESSAGE_ROUTED1(AutofillMsg_FormNotBlacklisted, 146 autofill::PasswordForm /* form checked */) 147 148 // Sent when requestAutocomplete() finishes (either succesfully or with an 149 // error). If it was a success, the renderer fills the form that requested 150 // autocomplete with the |form_data| values input by the user. 151 IPC_MESSAGE_ROUTED2(AutofillMsg_RequestAutocompleteResult, 152 blink::WebFormElement::AutocompleteResult /* result */, 153 autofill::FormData /* form_data */) 154 155 // Sent when the current page is actually displayed in the browser, possibly 156 // after being preloaded. 157 IPC_MESSAGE_ROUTED0(AutofillMsg_PageShown) 158 159 // Sent when Autofill manager gets the query response from the Autofill server 160 // and there are fields classified as ACCOUNT_CREATION_PASSWORD in the response. 161 IPC_MESSAGE_ROUTED1(AutofillMsg_AccountCreationFormsDetected, 162 std::vector<autofill::FormData> /* forms */) 163 164 // Autofill messages sent from the renderer to the browser. 165 166 // TODO(creis): check in the browser that the renderer actually has permission 167 // for the URL to avoid compromised renderers talking to the browser. 168 169 // Notification that forms have been seen that are candidates for 170 // filling/submitting by the AutofillManager. 171 IPC_MESSAGE_ROUTED3(AutofillHostMsg_FormsSeen, 172 std::vector<autofill::FormData> /* forms */, 173 base::TimeTicks /* timestamp */, 174 autofill::FormsSeenState /* state */) 175 176 // Notification that password forms have been seen that are candidates for 177 // filling/submitting by the password manager. 178 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsParsed, 179 std::vector<autofill::PasswordForm> /* forms */) 180 181 // Notification that initial layout has occurred and the following password 182 // forms are visible on the page (e.g. not set to display:none.) 183 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsRendered, 184 std::vector<autofill::PasswordForm> /* forms */) 185 186 // Notification that this password form was submitted by the user. 187 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormSubmitted, 188 autofill::PasswordForm /* form */) 189 190 // Notification that a form has been submitted. The user hit the button. 191 IPC_MESSAGE_ROUTED2(AutofillHostMsg_FormSubmitted, 192 autofill::FormData /* form */, 193 base::TimeTicks /* timestamp */) 194 195 // Notification that a form field's value has changed. 196 IPC_MESSAGE_ROUTED3(AutofillHostMsg_TextFieldDidChange, 197 autofill::FormData /* the form */, 198 autofill::FormFieldData /* the form field */, 199 base::TimeTicks /* timestamp */) 200 201 // Queries the browser for Autofill suggestions for a form input field. 202 IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill, 203 int /* id of this message */, 204 autofill::FormData /* the form */, 205 autofill::FormFieldData /* the form field */, 206 gfx::RectF /* input field bounds, window-relative */, 207 bool /* display warning if autofill disabled */) 208 209 // Instructs the browser to fill in the values for a form using Autofill 210 // profile data. 211 IPC_MESSAGE_ROUTED4(AutofillHostMsg_FillAutofillFormData, 212 int /* id of this message */, 213 autofill::FormData /* the form */, 214 autofill::FormFieldData /* the form field */, 215 int /* profile unique ID */) 216 217 // Sent when a form is previewed with Autofill suggestions. 218 IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidPreviewAutofillFormData) 219 220 // Sent when a form is filled with Autofill suggestions. 221 IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidFillAutofillFormData, 222 base::TimeTicks /* timestamp */) 223 224 // Sent when a form receives a request to do interactive autocomplete. 225 IPC_MESSAGE_ROUTED2(AutofillHostMsg_RequestAutocomplete, 226 autofill::FormData /* form_data */, 227 GURL /* frame_url */) 228 229 // Instructs the browser to show the Autofill dialog. 230 IPC_MESSAGE_ROUTED0(AutofillHostMsg_ShowAutofillDialog) 231 232 // Send when a text field is done editing. 233 IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidEndTextFieldEditing) 234 235 // Instructs the browser to hide the Autofill UI. 236 IPC_MESSAGE_ROUTED0(AutofillHostMsg_HideAutofillUI) 237 238 // Instructs the browser to show the password generation bubble at the 239 // specified location. This location should be specified in the renderers 240 // coordinate system. Form is the form associated with the password field. 241 IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordGenerationPopup, 242 gfx::Rect /* source location */, 243 int /* max length of the password */, 244 autofill::PasswordForm) 245 246 // Instruct the browser that a password mapping has been found for a field. 247 IPC_MESSAGE_ROUTED2(AutofillHostMsg_AddPasswordFormMapping, 248 autofill::FormFieldData, /* the user name field */ 249 autofill::PasswordFormFillData /* password pairings */) 250 251 // Instruct the browser to show a popup with the following suggestions from the 252 // password manager. 253 IPC_MESSAGE_ROUTED4(AutofillHostMsg_ShowPasswordSuggestions, 254 autofill::FormFieldData /* the form field */, 255 gfx::RectF /* input field bounds, window-relative */, 256 std::vector<base::string16> /* suggestions */, 257 std::vector<base::string16> /* realms */) 258 259 // Inform browser of data list values for the curent field. 260 IPC_MESSAGE_ROUTED2(AutofillHostMsg_SetDataList, 261 std::vector<base::string16> /* values */, 262 std::vector<base::string16> /* labels */) 263