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

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: element_frame now local to the if statement 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 if (blink::WebLocalFrame* element_frame = element.document().frame()) {
537 element.document().frame(), element.form(), RESTRICTION_NONE); 537 ProvisionallySavePassword(
538 element_frame, element.form(), RESTRICTION_NONE);
539 }
538 540
539 PasswordToLoginMap::iterator iter = password_to_username_.find(element); 541 PasswordToLoginMap::iterator iter = password_to_username_.find(element);
540 if (iter != password_to_username_.end()) { 542 if (iter != password_to_username_.end()) {
541 login_to_password_info_[iter->second].password_was_edited_last = true; 543 login_to_password_info_[iter->second].password_was_edited_last = true;
542 // Note that the suggested value of |mutable_element| was reset when its 544 // Note that the suggested value of |mutable_element| was reset when its
543 // value changed. 545 // value changed.
544 mutable_element.setAutofilled(false); 546 mutable_element.setAutofilled(false);
545 } 547 }
546 return false; 548 return false;
547 } 549 }
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form)); 1221 scoped_ptr<PasswordForm> password_form(CreatePasswordForm(form));
1220 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD && 1222 if (!password_form || (restriction == RESTRICTION_NON_EMPTY_PASSWORD &&
1221 password_form->password_value.empty() && 1223 password_form->password_value.empty() &&
1222 password_form->new_password_value.empty())) { 1224 password_form->new_password_value.empty())) {
1223 return; 1225 return;
1224 } 1226 }
1225 provisionally_saved_forms_[frame].reset(password_form.release()); 1227 provisionally_saved_forms_[frame].reset(password_form.release());
1226 } 1228 }
1227 1229
1228 } // namespace autofill 1230 } // 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