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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 password->SetSuggestedValue(blink::WebString()); | 1791 password->SetSuggestedValue(blink::WebString()); |
1792 password->SetAutofilled(was_password_autofilled_); | 1792 password->SetAutofilled(was_password_autofilled_); |
1793 } | 1793 } |
1794 } | 1794 } |
1795 | 1795 |
1796 void PasswordAutofillAgent::ProvisionallySavePassword( | 1796 void PasswordAutofillAgent::ProvisionallySavePassword( |
1797 std::unique_ptr<PasswordForm> password_form, | 1797 std::unique_ptr<PasswordForm> password_form, |
1798 const blink::WebFormElement& form, | 1798 const blink::WebFormElement& form, |
1799 const blink::WebInputElement& input, | 1799 const blink::WebInputElement& input, |
1800 ProvisionallySaveRestriction restriction) { | 1800 ProvisionallySaveRestriction restriction) { |
1801 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && | 1801 if (!password_form) |
1802 password_form->password_value.empty() && | |
1803 password_form->new_password_value.empty())) { | |
1804 return; | 1802 return; |
1805 } | 1803 bool has_no_password = password_form->password_value.empty() && |
| 1804 password_form->new_password_value.empty(); |
| 1805 if (restriction == RESTRICTION_NON_EMPTY_PASSWORD && has_no_password) |
| 1806 return; |
| 1807 |
1806 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); | 1808 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); |
1807 provisionally_saved_form_.Set(std::move(password_form), form, input); | 1809 provisionally_saved_form_.Set(std::move(password_form), form, input); |
| 1810 if (!has_no_password) { |
| 1811 GetPasswordManagerDriver()->ShowManualFallbackForSaving( |
| 1812 provisionally_saved_form_.password_form()); |
| 1813 } else { |
| 1814 GetPasswordManagerDriver()->HideManualFallbackForSaving(); |
| 1815 } |
1808 } | 1816 } |
1809 | 1817 |
1810 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { | 1818 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { |
1811 DCHECK(autofill_agent_); | 1819 DCHECK(autofill_agent_); |
1812 return autofill_agent_->GetAutofillDriver(); | 1820 return autofill_agent_->GetAutofillDriver(); |
1813 } | 1821 } |
1814 | 1822 |
1815 const mojom::PasswordManagerDriverPtr& | 1823 const mojom::PasswordManagerDriverPtr& |
1816 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1824 PasswordAutofillAgent::GetPasswordManagerDriver() { |
1817 if (!password_manager_driver_) { | 1825 if (!password_manager_driver_) { |
1818 render_frame()->GetRemoteInterfaces()->GetInterface( | 1826 render_frame()->GetRemoteInterfaces()->GetInterface( |
1819 mojo::MakeRequest(&password_manager_driver_)); | 1827 mojo::MakeRequest(&password_manager_driver_)); |
1820 } | 1828 } |
1821 | 1829 |
1822 return password_manager_driver_; | 1830 return password_manager_driver_; |
1823 } | 1831 } |
1824 | 1832 |
1825 } // namespace autofill | 1833 } // namespace autofill |
OLD | NEW |