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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 if (!password->suggestedValue().isEmpty()) { | 1210 if (!password->suggestedValue().isEmpty()) { |
1211 password->setSuggestedValue(blink::WebString()); | 1211 password->setSuggestedValue(blink::WebString()); |
1212 password->setAutofilled(was_password_autofilled_); | 1212 password->setAutofilled(was_password_autofilled_); |
1213 } | 1213 } |
1214 } | 1214 } |
1215 | 1215 |
1216 void PasswordAutofillAgent::ProvisionallySavePassword( | 1216 void PasswordAutofillAgent::ProvisionallySavePassword( |
1217 blink::WebLocalFrame* frame, | 1217 blink::WebLocalFrame* frame, |
1218 const blink::WebFormElement& form, | 1218 const blink::WebFormElement& form, |
1219 ProvisionallySaveRestriction restriction) { | 1219 ProvisionallySaveRestriction restriction) { |
1220 DCHECK(frame); | 1220 // TODO(vabr): This is just to stop getting a NULL frame in |
| 1221 // |provisionally_saved_forms_|. Cases where we try to save password for a |
| 1222 // form in a NULL frame should not happen, and it's currently unclear how they |
| 1223 // happen (http://crbug.com/420519). This thing will be hopefully solved by |
| 1224 // migrating the PasswordAutofillAgent to observe frames directly |
| 1225 // (http://crbug.com/400186). |
| 1226 if (!frame) |
| 1227 return; |
1221 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); | 1228 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); |
1222 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && | 1229 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && |
1223 password_form->password_value.empty() && | 1230 password_form->password_value.empty() && |
1224 password_form->new_password_value.empty())) { | 1231 password_form->new_password_value.empty())) { |
1225 return; | 1232 return; |
1226 } | 1233 } |
1227 provisionally_saved_forms_[frame].reset(password_form.release()); | 1234 provisionally_saved_forms_[frame].reset(password_form.release()); |
1228 } | 1235 } |
1229 | 1236 |
1230 } // namespace autofill | 1237 } // namespace autofill |
OLD | NEW |