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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 } | 665 } |
666 } | 666 } |
667 | 667 |
668 blink::WebFrame* PasswordAutofillAgent::CurrentOrChildFrameWithSavedForms( | 668 blink::WebFrame* PasswordAutofillAgent::CurrentOrChildFrameWithSavedForms( |
669 const blink::WebFrame* current_frame) { | 669 const blink::WebFrame* current_frame) { |
670 for (FrameToPasswordFormMap::const_iterator it = | 670 for (FrameToPasswordFormMap::const_iterator it = |
671 provisionally_saved_forms_.begin(); | 671 provisionally_saved_forms_.begin(); |
672 it != provisionally_saved_forms_.end(); | 672 it != provisionally_saved_forms_.end(); |
673 ++it) { | 673 ++it) { |
674 blink::WebFrame* form_frame = it->first; | 674 blink::WebFrame* form_frame = it->first; |
675 DCHECK(form_frame); | |
Ilya Sherman
2014/08/01 18:42:39
This is dereferenced on line 683 below, so I'm not
vabr (Chromium)
2014/08/01 19:10:13
Fair point, I removed it.
| |
675 // The check that the returned frame is related to |current_frame| is mainly | 676 // The check that the returned frame is related to |current_frame| is mainly |
676 // for double-checking. There should not be any unrelated frames in | 677 // for double-checking. There should not be any unrelated frames in |
677 // |provisionally_saved_forms_|, because the map is cleared after | 678 // |provisionally_saved_forms_|, because the map is cleared after |
678 // navigation. If there are reasons to remove this check in the future and | 679 // navigation. If there are reasons to remove this check in the future and |
679 // keep just the first frame found, it might be a good idea to add a UMA | 680 // keep just the first frame found, it might be a good idea to add a UMA |
680 // statistic or a similar check on how many frames are here to choose from. | 681 // statistic or a similar check on how many frames are here to choose from. |
681 if (current_frame == form_frame || | 682 if (current_frame == form_frame || |
682 current_frame->findChildByName(form_frame->assignedName())) { | 683 current_frame->findChildByName(form_frame->assignedName())) { |
683 return form_frame; | 684 return form_frame; |
684 } | 685 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1102 if (!password->suggestedValue().isEmpty()) { | 1103 if (!password->suggestedValue().isEmpty()) { |
1103 password->setSuggestedValue(blink::WebString()); | 1104 password->setSuggestedValue(blink::WebString()); |
1104 password->setAutofilled(was_password_autofilled_); | 1105 password->setAutofilled(was_password_autofilled_); |
1105 } | 1106 } |
1106 } | 1107 } |
1107 | 1108 |
1108 void PasswordAutofillAgent::ProvisionallySavePassword( | 1109 void PasswordAutofillAgent::ProvisionallySavePassword( |
1109 blink::WebLocalFrame* frame, | 1110 blink::WebLocalFrame* frame, |
1110 const blink::WebFormElement& form, | 1111 const blink::WebFormElement& form, |
1111 ProvisionallySaveRestriction restriction) { | 1112 ProvisionallySaveRestriction restriction) { |
1113 DCHECK(frame); | |
1112 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); | 1114 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); |
1113 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && | 1115 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && |
1114 password_form->password_value.empty() && | 1116 password_form->password_value.empty() && |
1115 password_form->new_password_value.empty())) { | 1117 password_form->new_password_value.empty())) { |
1116 return; | 1118 return; |
1117 } | 1119 } |
1118 provisionally_saved_forms_[frame].reset(password_form.release()); | 1120 provisionally_saved_forms_[frame].reset(password_form.release()); |
1119 } | 1121 } |
1120 | 1122 |
1121 } // namespace autofill | 1123 } // namespace autofill |
OLD | NEW |