| 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_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 void PasswordAutofillAgent::OnAutofillUsernameAndPasswordDataReceived( | 1424 void PasswordAutofillAgent::OnAutofillUsernameAndPasswordDataReceived( |
| 1425 const FormsPredictionsMap& predictions) { | 1425 const FormsPredictionsMap& predictions) { |
| 1426 form_predictions_.insert(predictions.begin(), predictions.end()); | 1426 form_predictions_.insert(predictions.begin(), predictions.end()); |
| 1427 } | 1427 } |
| 1428 | 1428 |
| 1429 void PasswordAutofillAgent::OnFindFocusedPasswordForm() { | 1429 void PasswordAutofillAgent::OnFindFocusedPasswordForm() { |
| 1430 std::unique_ptr<PasswordForm> password_form; | 1430 std::unique_ptr<PasswordForm> password_form; |
| 1431 | 1431 |
| 1432 blink::WebElement element = render_frame()->GetFocusedElement(); | 1432 blink::WebElement element = |
| 1433 render_frame()->GetWebFrame()->document().focusedElement(); |
| 1433 if (!element.isNull() && element.hasHTMLTagName("input")) { | 1434 if (!element.isNull() && element.hasHTMLTagName("input")) { |
| 1434 blink::WebInputElement input = element.to<blink::WebInputElement>(); | 1435 blink::WebInputElement input = element.to<blink::WebInputElement>(); |
| 1435 if (input.isPasswordField() && !input.form().isNull()) { | 1436 if (input.isPasswordField() && !input.form().isNull()) { |
| 1436 if (!input.form().isNull()) { | 1437 if (!input.form().isNull()) { |
| 1437 password_form = CreatePasswordFormFromWebForm( | 1438 password_form = CreatePasswordFormFromWebForm( |
| 1438 input.form(), &nonscript_modified_values_, &form_predictions_); | 1439 input.form(), &nonscript_modified_values_, &form_predictions_); |
| 1439 } else { | 1440 } else { |
| 1440 password_form = CreatePasswordFormFromUnownedInputElements( | 1441 password_form = CreatePasswordFormFromUnownedInputElements( |
| 1441 *render_frame()->GetWebFrame(), | 1442 *render_frame()->GetWebFrame(), |
| 1442 &nonscript_modified_values_, &form_predictions_); | 1443 &nonscript_modified_values_, &form_predictions_); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 } | 1539 } |
| 1539 | 1540 |
| 1540 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { | 1541 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { |
| 1541 return provisionally_saved_form_ && | 1542 return provisionally_saved_form_ && |
| 1542 !provisionally_saved_form_->username_value.empty() && | 1543 !provisionally_saved_form_->username_value.empty() && |
| 1543 !(provisionally_saved_form_->password_value.empty() && | 1544 !(provisionally_saved_form_->password_value.empty() && |
| 1544 provisionally_saved_form_->new_password_value.empty()); | 1545 provisionally_saved_form_->new_password_value.empty()); |
| 1545 } | 1546 } |
| 1546 | 1547 |
| 1547 } // namespace autofill | 1548 } // namespace autofill |
| OLD | NEW |