Chromium Code Reviews| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 879 const blink::WebInputElement& element, | 879 const blink::WebInputElement& element, |
| 880 blink::WebInputElement* username_element, | 880 blink::WebInputElement* username_element, |
| 881 blink::WebInputElement* password_element, | 881 blink::WebInputElement* password_element, |
| 882 PasswordInfo** password_info) { | 882 PasswordInfo** password_info) { |
| 883 DCHECK(username_element && password_element && password_info); | 883 DCHECK(username_element && password_element && password_info); |
| 884 username_element->Reset(); | 884 username_element->Reset(); |
| 885 password_element->Reset(); | 885 password_element->Reset(); |
| 886 if (!element.IsPasswordField()) { | 886 if (!element.IsPasswordField()) { |
| 887 *username_element = element; | 887 *username_element = element; |
| 888 } else { | 888 } else { |
| 889 // If there is a password field, but a request to the store hasn't been sent | |
| 890 // yet, then do fetch saved credentials now. | |
| 891 if (!sent_request_to_store_) | |
| 892 SendPasswordForms(false); | |
|
dvadym
2017/05/16 12:13:48
Nit: We could make return from this function. If n
kolos1
2017/05/17 09:05:30
Done.
| |
| 893 | |
| 889 WebInputToPasswordInfoMap::iterator iter = | 894 WebInputToPasswordInfoMap::iterator iter = |
| 890 web_input_to_password_info_.find(element); | 895 web_input_to_password_info_.find(element); |
| 891 if (iter != web_input_to_password_info_.end()) { | 896 if (iter != web_input_to_password_info_.end()) { |
| 892 // It's a password field without corresponding username field. | 897 // It's a password field without corresponding username field. |
| 893 *password_element = element; | 898 *password_element = element; |
| 894 *password_info = &iter->second; | 899 *password_info = &iter->second; |
| 895 return true; | 900 return true; |
| 896 } | 901 } |
| 897 PasswordToLoginMap::const_iterator password_iter = | 902 PasswordToLoginMap::const_iterator password_iter = |
| 898 password_to_username_.find(element); | 903 password_to_username_.find(element); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1217 HasPasswordField(*frame)) { | 1222 HasPasswordField(*frame)) { |
| 1218 // Set everything that |FormDigest| needs. | 1223 // Set everything that |FormDigest| needs. |
| 1219 password_forms.push_back(PasswordForm()); | 1224 password_forms.push_back(PasswordForm()); |
| 1220 password_forms.back().scheme = PasswordForm::SCHEME_HTML; | 1225 password_forms.back().scheme = PasswordForm::SCHEME_HTML; |
| 1221 password_forms.back().origin = | 1226 password_forms.back().origin = |
| 1222 form_util::GetCanonicalOriginForDocument(frame->GetDocument()); | 1227 form_util::GetCanonicalOriginForDocument(frame->GetDocument()); |
| 1223 GURL::Replacements rep; | 1228 GURL::Replacements rep; |
| 1224 rep.SetPathStr(""); | 1229 rep.SetPathStr(""); |
| 1225 password_forms.back().signon_realm = | 1230 password_forms.back().signon_realm = |
| 1226 password_forms.back().origin.ReplaceComponents(rep).spec(); | 1231 password_forms.back().origin.ReplaceComponents(rep).spec(); |
| 1232 } | |
| 1233 if (!password_forms.empty()) { | |
| 1227 sent_request_to_store_ = true; | 1234 sent_request_to_store_ = true; |
| 1235 GetPasswordManagerDriver()->PasswordFormsParsed(password_forms); | |
| 1228 } | 1236 } |
| 1229 if (!password_forms.empty()) | |
| 1230 GetPasswordManagerDriver()->PasswordFormsParsed(password_forms); | |
| 1231 } | 1237 } |
| 1232 } | 1238 } |
| 1233 | 1239 |
| 1234 void PasswordAutofillAgent::DidFinishDocumentLoad() { | 1240 void PasswordAutofillAgent::DidFinishDocumentLoad() { |
| 1235 // The |frame| contents have been parsed, but not yet rendered. Let the | 1241 // The |frame| contents have been parsed, but not yet rendered. Let the |
| 1236 // PasswordManager know that forms are loaded, even though we can't yet tell | 1242 // PasswordManager know that forms are loaded, even though we can't yet tell |
| 1237 // whether they're visible. | 1243 // whether they're visible. |
| 1238 form_util::ScopedLayoutPreventer layout_preventer; | 1244 form_util::ScopedLayoutPreventer layout_preventer; |
| 1239 SendPasswordForms(false); | 1245 SendPasswordForms(false); |
| 1240 } | 1246 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1724 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1730 PasswordAutofillAgent::GetPasswordManagerDriver() { |
| 1725 if (!password_manager_driver_) { | 1731 if (!password_manager_driver_) { |
| 1726 render_frame()->GetRemoteInterfaces()->GetInterface( | 1732 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 1727 mojo::MakeRequest(&password_manager_driver_)); | 1733 mojo::MakeRequest(&password_manager_driver_)); |
| 1728 } | 1734 } |
| 1729 | 1735 |
| 1730 return password_manager_driver_; | 1736 return password_manager_driver_; |
| 1731 } | 1737 } |
| 1732 | 1738 |
| 1733 } // namespace autofill | 1739 } // namespace autofill |
| OLD | NEW |