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

Unified Diff: components/autofill/content/renderer/password_generation_agent.cc

Issue 1084063002: [Password Generation] Fix bug where generation would never trigger on iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/password/framed_signup_form.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/password_generation_agent.cc
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc
index d77d1b262918168036526533f6d972a0af552f31..e780bb4d3e7a6190fd8c39e3ef1ae7d216180876 100644
--- a/components/autofill/content/renderer/password_generation_agent.cc
+++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -118,49 +118,50 @@ PasswordGenerationAgent::PasswordGenerationAgent(
PasswordGenerationAgent::~PasswordGenerationAgent() {}
void PasswordGenerationAgent::DidFinishDocumentLoad() {
- if (render_frame()->GetWebFrame()->parent())
- return;
+ // Update stats for main frame navigation.
+ if (!render_frame()->GetWebFrame()->parent()) {
+ // In every navigation, the IPC message sent by the password autofill
+ // manager to query whether the current form is blacklisted or not happens
+ // when the document load finishes, so we need to clear previous states
+ // here before we hear back from the browser. We only clear this state on
+ // main frame load as we don't want subframe loads to clear state that we
+ // have received from the main frame. Note that we assume there is only one
+ // account creation form, but there could be multiple password forms in
+ // each frame.
+ not_blacklisted_password_form_origins_.clear();
+ generation_enabled_forms_.clear();
+ generation_element_.reset();
+ possible_account_creation_forms_.clear();
- // In every navigation, the IPC message sent by the password autofill manager
- // to query whether the current form is blacklisted or not happens when the
- // document load finishes, so we need to clear previous states here before we
- // hear back from the browser. We only clear this state on main frame load
- // as we don't want subframe loads to clear state that we have received from
- // the main frame. Note that we assume there is only one account creation
- // form, but there could be multiple password forms in each frame.
- not_blacklisted_password_form_origins_.clear();
- generation_enabled_forms_.clear();
- generation_element_.reset();
- possible_account_creation_forms_.clear();
-
- // Log statistics after navigation so that we only log once per page.
- if (generation_form_data_ &&
- generation_form_data_->password_elements.empty()) {
- password_generation::LogPasswordGenerationEvent(
- password_generation::NO_SIGN_UP_DETECTED);
- } else {
- password_generation::LogPasswordGenerationEvent(
- password_generation::SIGN_UP_DETECTED);
- }
- generation_form_data_.reset();
- password_is_generated_ = false;
- if (password_edited_) {
- password_generation::LogPasswordGenerationEvent(
- password_generation::PASSWORD_EDITED);
- }
- password_edited_ = false;
+ // Log statistics after navigation so that we only log once per page.
+ if (generation_form_data_ &&
+ generation_form_data_->password_elements.empty()) {
+ password_generation::LogPasswordGenerationEvent(
+ password_generation::NO_SIGN_UP_DETECTED);
+ } else {
+ password_generation::LogPasswordGenerationEvent(
+ password_generation::SIGN_UP_DETECTED);
+ }
+ generation_form_data_.reset();
+ password_is_generated_ = false;
+ if (password_edited_) {
+ password_generation::LogPasswordGenerationEvent(
+ password_generation::PASSWORD_EDITED);
+ }
+ password_edited_ = false;
- if (generation_popup_shown_) {
- password_generation::LogPasswordGenerationEvent(
- password_generation::GENERATION_POPUP_SHOWN);
- }
- generation_popup_shown_ = false;
+ if (generation_popup_shown_) {
+ password_generation::LogPasswordGenerationEvent(
+ password_generation::GENERATION_POPUP_SHOWN);
+ }
+ generation_popup_shown_ = false;
- if (editing_popup_shown_) {
- password_generation::LogPasswordGenerationEvent(
- password_generation::EDITING_POPUP_SHOWN);
+ if (editing_popup_shown_) {
+ password_generation::LogPasswordGenerationEvent(
+ password_generation::EDITING_POPUP_SHOWN);
+ }
+ editing_popup_shown_ = false;
}
- editing_popup_shown_ = false;
FindPossibleGenerationForm();
}
@@ -213,7 +214,7 @@ void PasswordGenerationAgent::FindPossibleGenerationForm() {
if (!possible_account_creation_forms_.empty()) {
VLOG(2) << possible_account_creation_forms_.size()
- << " possible account creation forms deteceted";
+ << " possible account creation forms deteceted";
DetermineGenerationElement();
}
}
« no previous file with comments | « chrome/test/data/password/framed_signup_form.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698