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