| 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 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "components/autofill/content/renderer/form_autofill_util.h" | 8 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 password_form->username_value = username_value; | 212 password_form->username_value = username_value; |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Get the document URL | 215 // Get the document URL |
| 216 GURL full_origin(form.document().url()); | 216 GURL full_origin(form.document().url()); |
| 217 | 217 |
| 218 // Calculate the canonical action URL | 218 // Calculate the canonical action URL |
| 219 WebString action = form.action(); | 219 GURL full_action = GetCanonicalActionURL(form); |
| 220 if (action.isNull()) | |
| 221 action = WebString(""); // missing 'action' attribute implies current URL | |
| 222 GURL full_action(form.document().completeURL(action)); | |
| 223 if (!full_action.is_valid()) | 220 if (!full_action.is_valid()) |
| 224 return; | 221 return; |
| 225 | 222 |
| 226 WebInputElement password; | 223 WebInputElement password; |
| 227 WebInputElement new_password; | 224 WebInputElement new_password; |
| 228 if (!LocateSpecificPasswords(passwords, &password, &new_password)) | 225 if (!LocateSpecificPasswords(passwords, &password, &new_password)) |
| 229 return; | 226 return; |
| 230 | 227 |
| 231 // We want to keep the path but strip any authentication data, as well as | 228 // We want to keep the path but strip any authentication data, as well as |
| 232 // query and ref portions of URL, for the form action and form origin. | 229 // query and ref portions of URL, for the form action and form origin. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 WebFormElementToFormData(web_form, | 281 WebFormElementToFormData(web_form, |
| 285 blink::WebFormControlElement(), | 282 blink::WebFormControlElement(), |
| 286 REQUIRE_NONE, | 283 REQUIRE_NONE, |
| 287 EXTRACT_NONE, | 284 EXTRACT_NONE, |
| 288 &password_form->form_data, | 285 &password_form->form_data, |
| 289 NULL /* FormFieldData */); | 286 NULL /* FormFieldData */); |
| 290 | 287 |
| 291 return password_form.Pass(); | 288 return password_form.Pass(); |
| 292 } | 289 } |
| 293 | 290 |
| 291 GURL GetCanonicalActionURL(const WebFormElement& form) { |
| 292 WebString action = form.action(); |
| 293 if (action.isNull()) |
| 294 action = WebString(""); // missing 'action' attribute implies current URL |
| 295 return GURL(form.document().completeURL(action)); |
| 296 } |
| 297 |
| 294 } // namespace autofill | 298 } // namespace autofill |
| OLD | NEW |