| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 bool PasswordAutofillAgent::OriginCanAccessPasswordManager( | 986 bool PasswordAutofillAgent::OriginCanAccessPasswordManager( |
| 987 const blink::WebSecurityOrigin& origin) { | 987 const blink::WebSecurityOrigin& origin) { |
| 988 return origin.canAccessPasswordManager(); | 988 return origin.canAccessPasswordManager(); |
| 989 } | 989 } |
| 990 | 990 |
| 991 void PasswordAutofillAgent::OnDynamicFormsSeen() { | 991 void PasswordAutofillAgent::OnDynamicFormsSeen() { |
| 992 SendPasswordForms(false /* only_visible */); | 992 SendPasswordForms(false /* only_visible */); |
| 993 } | 993 } |
| 994 | 994 |
| 995 void PasswordAutofillAgent::AJAXSucceeded() { | 995 void PasswordAutofillAgent::AJAXSucceeded() { |
| 996 OnSamePageNavigationCompleted(); | 996 OnSameDocumentNavigationCompleted(); |
| 997 } | 997 } |
| 998 | 998 |
| 999 void PasswordAutofillAgent::OnSamePageNavigationCompleted() { | 999 void PasswordAutofillAgent::OnSameDocumentNavigationCompleted() { |
| 1000 if (!provisionally_saved_form_.IsPasswordValid()) | 1000 if (!provisionally_saved_form_.IsPasswordValid()) |
| 1001 return; | 1001 return; |
| 1002 | 1002 |
| 1003 // Prompt to save only if the form is now gone, either invisible or | 1003 // Prompt to save only if the form is now gone, either invisible or |
| 1004 // removed from the DOM. | 1004 // removed from the DOM. |
| 1005 blink::WebFrame* frame = render_frame()->GetWebFrame(); | 1005 blink::WebFrame* frame = render_frame()->GetWebFrame(); |
| 1006 const auto& password_form = provisionally_saved_form_.password_form(); | 1006 const auto& password_form = provisionally_saved_form_.password_form(); |
| 1007 if (form_util::IsFormVisible(frame, provisionally_saved_form_.form_element(), | 1007 if (form_util::IsFormVisible(frame, provisionally_saved_form_.form_element(), |
| 1008 password_form.action, password_form.origin, | 1008 password_form.action, password_form.origin, |
| 1009 password_form.form_data) || | 1009 password_form.form_data) || |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 // triggers the "Save password?" infobar if the user just submitted a password | 1147 // triggers the "Save password?" infobar if the user just submitted a password |
| 1148 // form. | 1148 // form. |
| 1149 SendPasswordForms(true); | 1149 SendPasswordForms(true); |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 void PasswordAutofillAgent::WillCommitProvisionalLoad() { | 1152 void PasswordAutofillAgent::WillCommitProvisionalLoad() { |
| 1153 FrameClosing(); | 1153 FrameClosing(); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void PasswordAutofillAgent::DidCommitProvisionalLoad( | 1156 void PasswordAutofillAgent::DidCommitProvisionalLoad( |
| 1157 bool is_new_navigation, bool is_same_page_navigation) { | 1157 bool is_new_navigation, |
| 1158 if (is_same_page_navigation) { | 1158 bool is_same_document_navigation) { |
| 1159 OnSamePageNavigationCompleted(); | 1159 if (is_same_document_navigation) { |
| 1160 OnSameDocumentNavigationCompleted(); |
| 1160 } | 1161 } |
| 1161 } | 1162 } |
| 1162 | 1163 |
| 1163 void PasswordAutofillAgent::FrameDetached() { | 1164 void PasswordAutofillAgent::FrameDetached() { |
| 1164 // If a sub frame has been destroyed while the user was entering information | 1165 // If a sub frame has been destroyed while the user was entering information |
| 1165 // into a password form, try to save the data. See https://crbug.com/450806 | 1166 // into a password form, try to save the data. See https://crbug.com/450806 |
| 1166 // for examples of sites that perform login using this technique. | 1167 // for examples of sites that perform login using this technique. |
| 1167 if (render_frame()->GetWebFrame()->parent() && | 1168 if (render_frame()->GetWebFrame()->parent() && |
| 1168 provisionally_saved_form_.IsPasswordValid()) { | 1169 provisionally_saved_form_.IsPasswordValid()) { |
| 1169 GetPasswordManagerDriver()->InPageNavigation( | 1170 GetPasswordManagerDriver()->InPageNavigation( |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1603 PasswordAutofillAgent::GetPasswordManagerDriver() { |
| 1603 if (!password_manager_driver_) { | 1604 if (!password_manager_driver_) { |
| 1604 render_frame()->GetRemoteInterfaces()->GetInterface( | 1605 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 1605 mojo::MakeRequest(&password_manager_driver_)); | 1606 mojo::MakeRequest(&password_manager_driver_)); |
| 1606 } | 1607 } |
| 1607 | 1608 |
| 1608 return password_manager_driver_; | 1609 return password_manager_driver_; |
| 1609 } | 1610 } |
| 1610 | 1611 |
| 1611 } // namespace autofill | 1612 } // namespace autofill |
| OLD | NEW |