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