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 12 matching lines...) Expand all Loading... | |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "components/autofill/content/renderer/form_autofill_util.h" | 26 #include "components/autofill/content/renderer/form_autofill_util.h" |
27 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 27 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
28 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" | 28 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" |
29 #include "components/autofill/core/common/autofill_constants.h" | 29 #include "components/autofill/core/common/autofill_constants.h" |
30 #include "components/autofill/core/common/autofill_util.h" | 30 #include "components/autofill/core/common/autofill_util.h" |
31 #include "components/autofill/core/common/form_field_data.h" | 31 #include "components/autofill/core/common/form_field_data.h" |
32 #include "components/autofill/core/common/password_form_fill_data.h" | 32 #include "components/autofill/core/common/password_form_fill_data.h" |
33 #include "components/password_manager/core/common/experiments.h" | |
33 #include "components/security_state/core/security_state.h" | 34 #include "components/security_state/core/security_state.h" |
34 #include "content/public/common/origin_util.h" | 35 #include "content/public/common/origin_util.h" |
35 #include "content/public/renderer/document_state.h" | 36 #include "content/public/renderer/document_state.h" |
36 #include "content/public/renderer/navigation_state.h" | 37 #include "content/public/renderer/navigation_state.h" |
37 #include "content/public/renderer/render_frame.h" | 38 #include "content/public/renderer/render_frame.h" |
38 #include "content/public/renderer/render_view.h" | 39 #include "content/public/renderer/render_view.h" |
39 #include "services/service_manager/public/cpp/binder_registry.h" | 40 #include "services/service_manager/public/cpp/binder_registry.h" |
40 #include "services/service_manager/public/cpp/interface_provider.h" | 41 #include "services/service_manager/public/cpp/interface_provider.h" |
41 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 42 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
42 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 43 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1762 password->SetSuggestedValue(blink::WebString()); | 1763 password->SetSuggestedValue(blink::WebString()); |
1763 password->SetAutofilled(was_password_autofilled_); | 1764 password->SetAutofilled(was_password_autofilled_); |
1764 } | 1765 } |
1765 } | 1766 } |
1766 | 1767 |
1767 void PasswordAutofillAgent::ProvisionallySavePassword( | 1768 void PasswordAutofillAgent::ProvisionallySavePassword( |
1768 std::unique_ptr<PasswordForm> password_form, | 1769 std::unique_ptr<PasswordForm> password_form, |
1769 const blink::WebFormElement& form, | 1770 const blink::WebFormElement& form, |
1770 const blink::WebInputElement& input, | 1771 const blink::WebInputElement& input, |
1771 ProvisionallySaveRestriction restriction) { | 1772 ProvisionallySaveRestriction restriction) { |
1772 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && | 1773 if (!password_form) |
1773 password_form->password_value.empty() && | |
1774 password_form->new_password_value.empty())) { | |
1775 return; | 1774 return; |
1776 } | 1775 bool has_no_password = password_form->password_value.empty() && |
1776 password_form->new_password_value.empty(); | |
1777 if (restriction == RESTRICTION_NON_EMPTY_PASSWORD && has_no_password) | |
1778 return; | |
1779 | |
1777 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); | 1780 DCHECK(password_form && (!form.IsNull() || !input.IsNull())); |
1778 provisionally_saved_form_.Set(std::move(password_form), form, input); | 1781 provisionally_saved_form_.Set(std::move(password_form), form, input); |
1782 if (password_manager::ManualFallbackForSavingEnabled()) { | |
vasilii
2017/07/21 12:48:20
Are you sure we need this check here? It introduce
kolos1
2017/07/24 15:33:30
The flag is removed.
| |
1783 if (!has_no_password) { | |
1784 GetPasswordManagerDriver()->ShowManualFallback( | |
1785 provisionally_saved_form_.password_form()); | |
1786 } else { | |
1787 GetPasswordManagerDriver()->HideManualFallback(); | |
1788 } | |
1789 } | |
1779 } | 1790 } |
1780 | 1791 |
1781 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { | 1792 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { |
1782 DCHECK(autofill_agent_); | 1793 DCHECK(autofill_agent_); |
1783 return autofill_agent_->GetAutofillDriver(); | 1794 return autofill_agent_->GetAutofillDriver(); |
1784 } | 1795 } |
1785 | 1796 |
1786 const mojom::PasswordManagerDriverPtr& | 1797 const mojom::PasswordManagerDriverPtr& |
1787 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1798 PasswordAutofillAgent::GetPasswordManagerDriver() { |
1788 if (!password_manager_driver_) { | 1799 if (!password_manager_driver_) { |
1789 render_frame()->GetRemoteInterfaces()->GetInterface( | 1800 render_frame()->GetRemoteInterfaces()->GetInterface( |
1790 mojo::MakeRequest(&password_manager_driver_)); | 1801 mojo::MakeRequest(&password_manager_driver_)); |
1791 } | 1802 } |
1792 | 1803 |
1793 return password_manager_driver_; | 1804 return password_manager_driver_; |
1794 } | 1805 } |
1795 | 1806 |
1796 } // namespace autofill | 1807 } // namespace autofill |
OLD | NEW |