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 <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 password->SetSuggestedValue(blink::WebString()); | 1762 password->SetSuggestedValue(blink::WebString()); |
1763 password->SetAutofilled(was_password_autofilled_); | 1763 password->SetAutofilled(was_password_autofilled_); |
1764 } | 1764 } |
1765 } | 1765 } |
1766 | 1766 |
1767 void PasswordAutofillAgent::ProvisionallySavePassword( | 1767 void PasswordAutofillAgent::ProvisionallySavePassword( |
1768 std::unique_ptr<PasswordForm> password_form, | 1768 std::unique_ptr<PasswordForm> password_form, |
1769 const blink::WebFormElement& form, | 1769 const blink::WebFormElement& form, |
1770 const blink::WebInputElement& input, | 1770 const blink::WebInputElement& input, |
1771 ProvisionallySaveRestriction restriction) { | 1771 ProvisionallySaveRestriction restriction) { |
1772 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && | 1772 if (!password_form) |
1773 password_form->password_value.empty() && | |
1774 password_form->new_password_value.empty())) { | |
1775 return; | 1773 return; |
1776 } | 1774 bool has_no_password = password_form->password_value.empty() && |
| 1775 password_form->new_password_value.empty(); |
| 1776 if (restriction == RESTRICTION_NON_EMPTY_PASSWORD && has_no_password) |
| 1777 return; |
| 1778 |
1777 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); | 1779 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); |
1778 provisionally_saved_form_.Set(std::move(password_form), form, input); | 1780 provisionally_saved_form_.Set(std::move(password_form), form, input); |
| 1781 if (!has_no_password) { |
| 1782 GetPasswordManagerDriver()->ShowManualFallbackForSaving( |
| 1783 provisionally_saved_form_.password_form()); |
| 1784 } else { |
| 1785 GetPasswordManagerDriver()->HideManualFallbackForSaving(); |
| 1786 } |
1779 } | 1787 } |
1780 | 1788 |
1781 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { | 1789 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { |
1782 DCHECK(autofill_agent_); | 1790 DCHECK(autofill_agent_); |
1783 return autofill_agent_->GetAutofillDriver(); | 1791 return autofill_agent_->GetAutofillDriver(); |
1784 } | 1792 } |
1785 | 1793 |
1786 const mojom::PasswordManagerDriverPtr& | 1794 const mojom::PasswordManagerDriverPtr& |
1787 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1795 PasswordAutofillAgent::GetPasswordManagerDriver() { |
1788 if (!password_manager_driver_) { | 1796 if (!password_manager_driver_) { |
1789 render_frame()->GetRemoteInterfaces()->GetInterface( | 1797 render_frame()->GetRemoteInterfaces()->GetInterface( |
1790 mojo::MakeRequest(&password_manager_driver_)); | 1798 mojo::MakeRequest(&password_manager_driver_)); |
1791 } | 1799 } |
1792 | 1800 |
1793 return password_manager_driver_; | 1801 return password_manager_driver_; |
1794 } | 1802 } |
1795 | 1803 |
1796 } // namespace autofill | 1804 } // namespace autofill |
OLD | NEW |