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