Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 649583003: PasswordAutofillAgent: do not provisionally save forms in NULL frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // TODO(vabr): Get a mutable argument instead. http://crbug.com/397083 526 // TODO(vabr): Get a mutable argument instead. http://crbug.com/397083
527 blink::WebInputElement mutable_element = element; // We need a non-const. 527 blink::WebInputElement mutable_element = element; // We need a non-const.
528 528
529 if (element.isPasswordField()) { 529 if (element.isPasswordField()) {
530 // Some login forms have event handlers that put a hash of the password into 530 // Some login forms have event handlers that put a hash of the password into
531 // a hidden field and then clear the password (http://crbug.com/28910, 531 // a hidden field and then clear the password (http://crbug.com/28910,
532 // http://crbug.com/391693). This method gets called before any of those 532 // http://crbug.com/391693). This method gets called before any of those
533 // handlers run, so save away a copy of the password in case it gets lost. 533 // handlers run, so save away a copy of the password in case it gets lost.
534 // To honor the user having explicitly cleared the password, even an empty 534 // To honor the user having explicitly cleared the password, even an empty
535 // password will be saved here. 535 // password will be saved here.
536 ProvisionallySavePassword( 536 blink::WebLocalFrame* element_frame = element.document().frame();
537 element.document().frame(), element.form(), RESTRICTION_NONE); 537 if (element_frame) {
Mike West 2014/10/13 13:13:00 You can put the whole assignment into the 'if'.
vabr (Chromium) 2014/10/13 13:53:17 Done.
538 ProvisionallySavePassword(
539 element_frame, element.form(), RESTRICTION_NONE);
540 }
538 541
539 PasswordToLoginMap::iterator iter = password_to_username_.find(element); 542 PasswordToLoginMap::iterator iter = password_to_username_.find(element);
Mike West 2014/10/13 13:13:00 Do we need to do the rest of this if we're not in
vabr (Chromium) 2014/10/13 13:53:17 The second part is there for cases, where the user
540 if (iter != password_to_username_.end()) { 543 if (iter != password_to_username_.end()) {
541 login_to_password_info_[iter->second].password_was_edited_last = true; 544 login_to_password_info_[iter->second].password_was_edited_last = true;
542 // Note that the suggested value of |mutable_element| was reset when its 545 // Note that the suggested value of |mutable_element| was reset when its
543 // value changed. 546 // value changed.
544 mutable_element.setAutofilled(false); 547 mutable_element.setAutofilled(false);
545 } 548 }
546 return false; 549 return false;
547 } 550 }
548 551
549 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(element); 552 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(element);
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); 1222 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form));
1220 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && 1223 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD &&
1221 password_form->password_value.empty() && 1224 password_form->password_value.empty() &&
1222 password_form->new_password_value.empty())) { 1225 password_form->new_password_value.empty())) {
1223 return; 1226 return;
1224 } 1227 }
1225 provisionally_saved_forms_[frame].reset(password_form.release()); 1228 provisionally_saved_forms_[frame].reset(password_form.release());
1226 } 1229 }
1227 1230
1228 } // namespace autofill 1231 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698