Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Multiply-included message file, hence no include guard. | 5 // Multiply-included message file, hence no include guard. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/autofill/content/common/autofill_param_traits_macros.h" | 12 #include "components/autofill/content/common/autofill_param_traits_macros.h" |
| 13 #include "components/autofill/core/common/form_data.h" | 13 #include "components/autofill/core/common/form_data.h" |
| 14 #include "components/autofill/core/common/form_data_predictions.h" | 14 #include "components/autofill/core/common/form_data_predictions.h" |
|
vabr (Chromium)
2016/08/09 17:36:17
Looks like most of the structures #included here a
leonhsl(Using Gerrit)
2016/08/10 13:22:02
Yeah, Agree. Slim down this file and also cleaned
| |
| 15 #include "components/autofill/core/common/form_field_data.h" | 15 #include "components/autofill/core/common/form_field_data.h" |
| 16 #include "components/autofill/core/common/form_field_data_predictions.h" | 16 #include "components/autofill/core/common/form_field_data_predictions.h" |
| 17 #include "components/autofill/core/common/password_form.h" | 17 #include "components/autofill/core/common/password_form.h" |
| 18 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 18 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| 19 #include "components/autofill/core/common/password_form_fill_data.h" | 19 #include "components/autofill/core/common/password_form_fill_data.h" |
| 20 #include "components/autofill/core/common/password_form_generation_data.h" | 20 #include "components/autofill/core/common/password_form_generation_data.h" |
| 21 #include "content/public/common/common_param_traits.h" | 21 #include "content/public/common/common_param_traits.h" |
| 22 #include "content/public/common/common_param_traits_macros.h" | 22 #include "content/public/common/common_param_traits_macros.h" |
| 23 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
| 24 #include "ipc/ipc_message_utils.h" | 24 #include "ipc/ipc_message_utils.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 IPC_STRUCT_TRAITS_MEMBER(other_possible_usernames) | 99 IPC_STRUCT_TRAITS_MEMBER(other_possible_usernames) |
| 100 IPC_STRUCT_TRAITS_MEMBER(wait_for_username) | 100 IPC_STRUCT_TRAITS_MEMBER(wait_for_username) |
| 101 IPC_STRUCT_TRAITS_MEMBER(is_possible_change_password_form) | 101 IPC_STRUCT_TRAITS_MEMBER(is_possible_change_password_form) |
| 102 IPC_STRUCT_TRAITS_END() | 102 IPC_STRUCT_TRAITS_END() |
| 103 | 103 |
| 104 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordAndRealm) | 104 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordAndRealm) |
| 105 IPC_STRUCT_TRAITS_MEMBER(password) | 105 IPC_STRUCT_TRAITS_MEMBER(password) |
| 106 IPC_STRUCT_TRAITS_MEMBER(realm) | 106 IPC_STRUCT_TRAITS_MEMBER(realm) |
| 107 IPC_STRUCT_TRAITS_END() | 107 IPC_STRUCT_TRAITS_END() |
| 108 | 108 |
| 109 // Singly-included section for type definitions. | |
| 110 #ifndef COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_MESSAGES_H_ | |
| 111 #define COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_MESSAGES_H_ | |
| 112 | |
| 113 // IPC_MESSAGE macros fail on the std::map, when expanding. We need to define | |
| 114 // a type to avoid that. | |
| 115 using FormsPredictionsMap = | |
| 116 std::map<autofill::FormData, autofill::PasswordFormFieldPredictionMap>; | |
| 117 | |
| 118 #endif // COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_MESSAGES_H_ | |
| 119 | |
| 120 // Autofill messages sent from the browser to the renderer. | |
| 121 | |
| 122 // Fill a password form and prepare field autocomplete for multiple | |
| 123 // matching logins. Lets the renderer know if it should disable the popup | |
| 124 // because the browser process will own the popup UI. |key| serves for | |
| 125 // identifying the fill form data in subsequent | |
| 126 // AutofillHostMsg_ShowPasswordSuggestions messages to the browser. | |
| 127 IPC_MESSAGE_ROUTED2(AutofillMsg_FillPasswordForm, | |
| 128 int /* key */, | |
| 129 autofill::PasswordFormFillData /* the fill form data*/) | |
| 130 | |
| 131 // Notification to start (|active| == true) or stop (|active| == false) logging | |
| 132 // the decisions made about saving the password. | |
| 133 IPC_MESSAGE_ROUTED1(AutofillMsg_SetLoggingState, bool /* active */) | |
| 134 | |
| 135 // Tells the renderer to populate the correct password fields with this | |
| 136 // generated password. | |
| 137 IPC_MESSAGE_ROUTED1(AutofillMsg_GeneratedPasswordAccepted, | |
| 138 base::string16 /* generated_password */) | |
| 139 | |
| 140 // Tells the renderer to enable the form classifier. | |
| 141 IPC_MESSAGE_ROUTED0(AutofillMsg_AllowToRunFormClassifier) | |
| 142 | |
| 143 // Tells the renderer to find the focused password form (assuming it exists). | |
| 144 // Renderer is expected to respond with the message | |
| 145 // |AutofillHostMsg_FocusedPasswordFormFound|. | |
| 146 IPC_MESSAGE_ROUTED0(AutofillMsg_FindFocusedPasswordForm) | |
| 147 | |
| 148 // Tells the renderer to find a focused element, and if it is a password field | |
| 149 // eligible for generation then to trigger generation by responding to the | |
| 150 // browser with the message |AutofillHostMsg_ShowPasswordGenerationPopup|. | |
| 151 IPC_MESSAGE_ROUTED0(AutofillMsg_UserTriggeredGeneratePassword) | |
| 152 | |
| 153 // Tells the renderer that this password form is not blacklisted. A form can | |
| 154 // be blacklisted if a user chooses "never save passwords for this site". | |
| 155 IPC_MESSAGE_ROUTED1(AutofillMsg_FormNotBlacklisted, | |
| 156 autofill::PasswordForm /* form checked */) | |
| 157 | |
| 158 // Sent when Autofill manager gets the query response from the Autofill server | |
| 159 // and there are fields classified for password generation in the response. | |
| 160 IPC_MESSAGE_ROUTED1( | |
| 161 AutofillMsg_FoundFormsEligibleForGeneration, | |
| 162 std::vector<autofill::PasswordFormGenerationData> /* forms */) | |
| 163 | |
| 164 // Sent when Autofill manager gets the query response from the Autofill server | |
| 165 // which contains information about username and password fields for some forms. | |
| 166 // |predictions| maps forms to their username fields. | |
| 167 IPC_MESSAGE_ROUTED1(AutofillMsg_AutofillUsernameAndPasswordDataReceived, | |
| 168 FormsPredictionsMap /* predictions */) | |
| 169 | |
| 170 // Autofill messages sent from the renderer to the browser. | |
| 171 | |
| 172 // TODO(creis): check in the browser that the renderer actually has permission | |
| 173 // for the URL to avoid compromised renderers talking to the browser. | |
| 174 | |
| 175 // Notification that password forms have been seen that are candidates for | |
| 176 // filling/submitting by the password manager. | |
| 177 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsParsed, | |
| 178 std::vector<autofill::PasswordForm> /* forms */) | |
| 179 | |
| 180 // Notification that initial layout has occurred and the following password | |
| 181 // forms are visible on the page (e.g. not set to display:none.), and whether | |
| 182 // all frames in the page have been rendered. | |
| 183 IPC_MESSAGE_ROUTED2(AutofillHostMsg_PasswordFormsRendered, | |
| 184 std::vector<autofill::PasswordForm> /* forms */, | |
| 185 bool /* did_stop_loading */) | |
| 186 | |
| 187 // A ping to the browser that PasswordAutofillAgent was constructed. As a | |
| 188 // consequence, the browser sends AutofillMsg_SetLoggingState with the current | |
| 189 // state of the logging activity. | |
| 190 IPC_MESSAGE_ROUTED0(AutofillHostMsg_PasswordAutofillAgentConstructed) | |
| 191 | |
| 192 // Notification that this password form was submitted by the user. | |
| 193 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormSubmitted, | |
| 194 autofill::PasswordForm /* form */) | |
| 195 | |
| 196 // Notification that in-page navigation happened and at this moment we have | |
| 197 // filled password form. We use this as a signal for successful login. | |
| 198 IPC_MESSAGE_ROUTED1(AutofillHostMsg_InPageNavigation, | |
| 199 autofill::PasswordForm /* form */) | |
| 200 | |
| 201 // Sends |log| to browser for displaying to the user. Only strings passed as an | |
| 202 // argument to methods overriding SavePasswordProgressLogger::SendLog may become | |
| 203 // |log|, because those are guaranteed to be sanitized. Never pass a free-form | |
| 204 // string as |log|. | |
| 205 IPC_MESSAGE_ROUTED1(AutofillHostMsg_RecordSavePasswordProgress, | |
| 206 std::string /* log */) | |
| 207 | |
| 208 // Queries the browser for Autofill suggestions for a form input field. | |
| 209 IPC_MESSAGE_ROUTED4(AutofillHostMsg_QueryFormFieldAutofill, | |
| 210 int /* id of this message */, | |
| 211 autofill::FormData /* the form */, | |
| 212 autofill::FormFieldData /* the form field */, | |
| 213 gfx::RectF /* input field bounds, window-relative */) | |
| 214 | |
| 215 // Instructs the browser that generation is available for this particular form. | 109 // Instructs the browser that generation is available for this particular form. |
| 216 // This is used for UMA stats. | 110 // This is used for UMA stats. |
| 217 IPC_MESSAGE_ROUTED1(AutofillHostMsg_GenerationAvailableForForm, | 111 IPC_MESSAGE_ROUTED1(AutofillHostMsg_GenerationAvailableForForm, |
| 218 autofill::PasswordForm) | 112 autofill::PasswordForm) |
| 219 | 113 |
| 220 // Instructs the browser to show the password generation popup at the | 114 // Instructs the browser to show the password generation popup at the |
| 221 // specified location. This location should be specified in the renderers | 115 // specified location. This location should be specified in the renderers |
| 222 // coordinate system. Form is the form associated with the password field. | 116 // coordinate system. Form is the form associated with the password field. |
| 223 IPC_MESSAGE_ROUTED5(AutofillHostMsg_ShowPasswordGenerationPopup, | 117 IPC_MESSAGE_ROUTED5(AutofillHostMsg_ShowPasswordGenerationPopup, |
| 224 gfx::RectF /* source location */, | 118 gfx::RectF /* source location */, |
| 225 int /* max length of the password */, | 119 int /* max length of the password */, |
| 226 base::string16, /* password field */ | 120 base::string16, /* password field */ |
| 227 bool, /* is manually triggered */ | 121 bool, /* is manually triggered */ |
| 228 autofill::PasswordForm) | 122 autofill::PasswordForm) |
| 229 | 123 |
| 230 // Instructs the browser to show the popup for editing a generated password. | 124 // Instructs the browser to show the popup for editing a generated password. |
| 231 // The location should be specified in the renderers coordinate system. Form | 125 // The location should be specified in the renderers coordinate system. Form |
| 232 // is the form associated with the password field. | 126 // is the form associated with the password field. |
| 233 IPC_MESSAGE_ROUTED2(AutofillHostMsg_ShowPasswordEditingPopup, | 127 IPC_MESSAGE_ROUTED2(AutofillHostMsg_ShowPasswordEditingPopup, |
| 234 gfx::RectF /* source location */, | 128 gfx::RectF /* source location */, |
| 235 autofill::PasswordForm) | 129 autofill::PasswordForm) |
| 236 | 130 |
| 237 // Instructs the browser to hide any password generation popups. | 131 // Instructs the browser to hide any password generation popups. |
| 238 IPC_MESSAGE_ROUTED0(AutofillHostMsg_HidePasswordGenerationPopup) | 132 IPC_MESSAGE_ROUTED0(AutofillHostMsg_HidePasswordGenerationPopup) |
| 239 | |
| 240 // Instructs the browser to presave the form with generated password. | |
| 241 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PresaveGeneratedPassword, | |
| 242 autofill::PasswordForm) | |
| 243 | |
| 244 // Instructs the browser that form no longer contains a generated password and | |
| 245 // the presaved form should be removed. | |
| 246 IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordNoLongerGenerated, | |
| 247 autofill::PasswordForm) | |
| 248 | |
| 249 // Sends the outcome of HTML parsing based form classifier that detects the | |
| 250 // forms where password generation should be available. | |
| 251 IPC_MESSAGE_ROUTED2(AutofillHostMsg_SaveGenerationFieldDetectedByClassifier, | |
| 252 autofill::PasswordForm, | |
| 253 base::string16 /* generation field */) | |
| 254 | |
| 255 // Instruct the browser to show a popup with suggestions filled from data | |
| 256 // associated with |key|. The popup will use |text_direction| for displaying | |
| 257 // text. | |
| 258 IPC_MESSAGE_ROUTED5( | |
| 259 AutofillHostMsg_ShowPasswordSuggestions, | |
| 260 int /* key */, | |
| 261 base::i18n::TextDirection /* text_direction */, | |
| 262 base::string16 /* username typed by user */, | |
| 263 int /* options bitmask of autofill::ShowPasswordSuggestionsOptions */, | |
| 264 gfx::RectF /* input field bounds, window-relative */) | |
| 265 | |
| 266 // Inform the browser which password form is currently focused, as a response | |
| 267 // to the |AutofillMsg_FindFocusedPasswordForm| request. If no password form | |
| 268 // is focused, the response will contain an empty |autofill::PasswordForm|. | |
| 269 IPC_MESSAGE_ROUTED1(AutofillHostMsg_FocusedPasswordFormFound, | |
| 270 autofill::PasswordForm) | |
| OLD | NEW |