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 "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" |
| 14 #include "components/autofill/core/common/form_data_predictions.h" |
| 15 #include "components/autofill/core/common/form_field_data.h" |
| 16 #include "components/autofill/core/common/form_field_data_predictions.h" |
12 #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" |
| 19 #include "components/autofill/core/common/password_form_fill_data.h" |
| 20 #include "components/autofill/core/common/password_form_generation_data.h" |
13 #include "content/public/common/common_param_traits.h" | 21 #include "content/public/common/common_param_traits.h" |
14 #include "content/public/common/common_param_traits_macros.h" | 22 #include "content/public/common/common_param_traits_macros.h" |
15 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
16 #include "ipc/ipc_message_utils.h" | 24 #include "ipc/ipc_message_utils.h" |
17 #include "ui/gfx/geometry/rect_f.h" | 25 #include "ui/gfx/geometry/rect_f.h" |
18 #include "ui/gfx/ipc/gfx_param_traits.h" | 26 #include "ui/gfx/ipc/gfx_param_traits.h" |
| 27 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" |
| 28 #include "url/gurl.h" |
19 | 29 |
20 #define IPC_MESSAGE_START AutofillMsgStart | 30 #define IPC_MESSAGE_START AutofillMsgStart |
21 | 31 |
22 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormFieldData::CheckStatus, | 32 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormFieldData::CheckStatus, |
23 autofill::FormFieldData::CheckStatus::CHECKED) | 33 autofill::FormFieldData::CheckStatus::CHECKED) |
24 | 34 |
25 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormFieldData::RoleAttribute, | 35 IPC_ENUM_TRAITS_MAX_VALUE(autofill::FormFieldData::RoleAttribute, |
26 autofill::FormFieldData::ROLE_ATTRIBUTE_OTHER) | 36 autofill::FormFieldData::ROLE_ATTRIBUTE_OTHER) |
27 | 37 |
| 38 IPC_ENUM_TRAITS_MAX_VALUE( |
| 39 autofill::PasswordFormFieldPredictionType, |
| 40 autofill::PasswordFormFieldPredictionType::PREDICTION_MAX) |
| 41 |
28 IPC_ENUM_TRAITS_MAX_VALUE(base::i18n::TextDirection, | 42 IPC_ENUM_TRAITS_MAX_VALUE(base::i18n::TextDirection, |
29 base::i18n::TEXT_DIRECTION_NUM_DIRECTIONS - 1) | 43 base::i18n::TEXT_DIRECTION_NUM_DIRECTIONS - 1) |
30 | 44 |
31 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldData) | 45 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldData) |
32 IPC_STRUCT_TRAITS_MEMBER(label) | 46 IPC_STRUCT_TRAITS_MEMBER(label) |
33 IPC_STRUCT_TRAITS_MEMBER(name) | 47 IPC_STRUCT_TRAITS_MEMBER(name) |
34 IPC_STRUCT_TRAITS_MEMBER(value) | 48 IPC_STRUCT_TRAITS_MEMBER(value) |
35 IPC_STRUCT_TRAITS_MEMBER(form_control_type) | 49 IPC_STRUCT_TRAITS_MEMBER(form_control_type) |
36 IPC_STRUCT_TRAITS_MEMBER(autocomplete_attribute) | 50 IPC_STRUCT_TRAITS_MEMBER(autocomplete_attribute) |
37 IPC_STRUCT_TRAITS_MEMBER(placeholder) | 51 IPC_STRUCT_TRAITS_MEMBER(placeholder) |
38 IPC_STRUCT_TRAITS_MEMBER(role) | 52 IPC_STRUCT_TRAITS_MEMBER(role) |
39 IPC_STRUCT_TRAITS_MEMBER(max_length) | 53 IPC_STRUCT_TRAITS_MEMBER(max_length) |
40 IPC_STRUCT_TRAITS_MEMBER(is_autofilled) | 54 IPC_STRUCT_TRAITS_MEMBER(is_autofilled) |
41 IPC_STRUCT_TRAITS_MEMBER(check_status) | 55 IPC_STRUCT_TRAITS_MEMBER(check_status) |
42 IPC_STRUCT_TRAITS_MEMBER(is_focusable) | 56 IPC_STRUCT_TRAITS_MEMBER(is_focusable) |
43 IPC_STRUCT_TRAITS_MEMBER(should_autocomplete) | 57 IPC_STRUCT_TRAITS_MEMBER(should_autocomplete) |
44 IPC_STRUCT_TRAITS_MEMBER(text_direction) | 58 IPC_STRUCT_TRAITS_MEMBER(text_direction) |
45 IPC_STRUCT_TRAITS_MEMBER(option_values) | 59 IPC_STRUCT_TRAITS_MEMBER(option_values) |
46 IPC_STRUCT_TRAITS_MEMBER(option_contents) | 60 IPC_STRUCT_TRAITS_MEMBER(option_contents) |
47 IPC_STRUCT_TRAITS_MEMBER(css_classes) | 61 IPC_STRUCT_TRAITS_MEMBER(css_classes) |
48 IPC_STRUCT_TRAITS_MEMBER(properties_mask) | 62 IPC_STRUCT_TRAITS_MEMBER(properties_mask) |
49 IPC_STRUCT_TRAITS_END() | 63 IPC_STRUCT_TRAITS_END() |
50 | 64 |
| 65 IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldDataPredictions) |
| 66 IPC_STRUCT_TRAITS_MEMBER(field) |
| 67 IPC_STRUCT_TRAITS_MEMBER(signature) |
| 68 IPC_STRUCT_TRAITS_MEMBER(heuristic_type) |
| 69 IPC_STRUCT_TRAITS_MEMBER(server_type) |
| 70 IPC_STRUCT_TRAITS_MEMBER(overall_type) |
| 71 IPC_STRUCT_TRAITS_MEMBER(parseable_name) |
| 72 IPC_STRUCT_TRAITS_END() |
| 73 |
| 74 IPC_STRUCT_TRAITS_BEGIN(autofill::FormDataPredictions) |
| 75 IPC_STRUCT_TRAITS_MEMBER(data) |
| 76 IPC_STRUCT_TRAITS_MEMBER(signature) |
| 77 IPC_STRUCT_TRAITS_MEMBER(fields) |
| 78 IPC_STRUCT_TRAITS_END() |
| 79 |
| 80 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordFormGenerationData) |
| 81 IPC_STRUCT_TRAITS_MEMBER(name) |
| 82 IPC_STRUCT_TRAITS_MEMBER(action) |
| 83 IPC_STRUCT_TRAITS_MEMBER(generation_field) |
| 84 IPC_STRUCT_TRAITS_END() |
| 85 |
| 86 IPC_STRUCT_TRAITS_BEGIN(autofill::UsernamesCollectionKey) |
| 87 IPC_STRUCT_TRAITS_MEMBER(username) |
| 88 IPC_STRUCT_TRAITS_MEMBER(password) |
| 89 IPC_STRUCT_TRAITS_END() |
| 90 |
| 91 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordFormFillData) |
| 92 IPC_STRUCT_TRAITS_MEMBER(name) |
| 93 IPC_STRUCT_TRAITS_MEMBER(origin) |
| 94 IPC_STRUCT_TRAITS_MEMBER(action) |
| 95 IPC_STRUCT_TRAITS_MEMBER(username_field) |
| 96 IPC_STRUCT_TRAITS_MEMBER(password_field) |
| 97 IPC_STRUCT_TRAITS_MEMBER(preferred_realm) |
| 98 IPC_STRUCT_TRAITS_MEMBER(additional_logins) |
| 99 IPC_STRUCT_TRAITS_MEMBER(other_possible_usernames) |
| 100 IPC_STRUCT_TRAITS_MEMBER(wait_for_username) |
| 101 IPC_STRUCT_TRAITS_MEMBER(is_possible_change_password_form) |
| 102 IPC_STRUCT_TRAITS_END() |
| 103 |
| 104 IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordAndRealm) |
| 105 IPC_STRUCT_TRAITS_MEMBER(password) |
| 106 IPC_STRUCT_TRAITS_MEMBER(realm) |
| 107 IPC_STRUCT_TRAITS_END() |
| 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 |
51 // Instructs the browser that generation is available for this particular form. | 215 // Instructs the browser that generation is available for this particular form. |
52 // This is used for UMA stats. | 216 // This is used for UMA stats. |
53 IPC_MESSAGE_ROUTED1(AutofillHostMsg_GenerationAvailableForForm, | 217 IPC_MESSAGE_ROUTED1(AutofillHostMsg_GenerationAvailableForForm, |
54 autofill::PasswordForm) | 218 autofill::PasswordForm) |
55 | 219 |
56 // Instructs the browser to show the password generation popup at the | 220 // Instructs the browser to show the password generation popup at the |
57 // specified location. This location should be specified in the renderers | 221 // specified location. This location should be specified in the renderers |
58 // coordinate system. Form is the form associated with the password field. | 222 // coordinate system. Form is the form associated with the password field. |
59 IPC_MESSAGE_ROUTED5(AutofillHostMsg_ShowPasswordGenerationPopup, | 223 IPC_MESSAGE_ROUTED5(AutofillHostMsg_ShowPasswordGenerationPopup, |
60 gfx::RectF /* source location */, | 224 gfx::RectF /* source location */, |
61 int /* max length of the password */, | 225 int /* max length of the password */, |
62 base::string16, /* password field */ | 226 base::string16, /* password field */ |
63 bool, /* is manually triggered */ | 227 bool, /* is manually triggered */ |
64 autofill::PasswordForm) | 228 autofill::PasswordForm) |
65 | 229 |
66 // Instructs the browser to show the popup for editing a generated password. | 230 // Instructs the browser to show the popup for editing a generated password. |
67 // The location should be specified in the renderers coordinate system. Form | 231 // The location should be specified in the renderers coordinate system. Form |
68 // is the form associated with the password field. | 232 // is the form associated with the password field. |
69 IPC_MESSAGE_ROUTED2(AutofillHostMsg_ShowPasswordEditingPopup, | 233 IPC_MESSAGE_ROUTED2(AutofillHostMsg_ShowPasswordEditingPopup, |
70 gfx::RectF /* source location */, | 234 gfx::RectF /* source location */, |
71 autofill::PasswordForm) | 235 autofill::PasswordForm) |
72 | 236 |
73 // Instructs the browser to hide any password generation popups. | 237 // Instructs the browser to hide any password generation popups. |
74 IPC_MESSAGE_ROUTED0(AutofillHostMsg_HidePasswordGenerationPopup) | 238 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 |