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

Unified Diff: chrome/renderer/render_view.cc

Issue 1656005: Fix password mgr heuristics for sites that keep the login form around after signin (Closed)
Patch Set: Responding to feedback Created 10 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/renderer/render_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 5b62f3286cc07b0cef81413654b3bbc9cfd2cc74..63472d2c0223906200219eabc5a6ef084a936f68 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2676,7 +2676,7 @@ void RenderView::didFinishDocumentLoad(WebFrame* frame) {
// TODO(jhawkins): Make these use the FormManager.
form_manager_.ExtractForms(frame);
SendForms(frame);
- SendPasswordForms(frame);
+ SendPasswordForms(frame, false);
// Check whether we have new encoding name.
UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
@@ -2720,6 +2720,9 @@ void RenderView::didFinishLoad(WebFrame* frame) {
DCHECK(navigation_state);
navigation_state->set_finish_load_time(Time::Now());
navigation_state->user_script_idle_scheduler()->DidFinishLoad();
+
+ // Let the password manager know which password forms are actually visible.
+ SendPasswordForms(frame, true);
}
void RenderView::didNavigateWithinPage(
@@ -4709,7 +4712,7 @@ void RenderView::didChangeAccessibilityObjectState(
#endif
}
-void RenderView::SendPasswordForms(WebFrame* frame) {
+void RenderView::SendPasswordForms(WebFrame* frame, bool only_visible) {
WebVector<WebFormElement> forms;
frame->forms(forms);
@@ -4718,16 +4721,22 @@ void RenderView::SendPasswordForms(WebFrame* frame) {
const WebFormElement& form = forms[i];
// Respect autocomplete=off.
- if (form.autoComplete()) {
- scoped_ptr<PasswordForm> password_form(
- PasswordFormDomManager::CreatePasswordForm(form));
- if (password_form.get())
- password_forms.push_back(*password_form);
- }
+ if (!form.autoComplete())
+ continue;
+ if (only_visible && !form.hasNonEmptyBoundingBox())
+ continue;
+ scoped_ptr<PasswordForm> password_form(
+ PasswordFormDomManager::CreatePasswordForm(form));
+ if (password_form.get())
+ password_forms.push_back(*password_form);
}
- if (!password_forms.empty())
- Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms));
+ if (password_forms.empty())
+ return;
+ if (only_visible)
+ Send(new ViewHostMsg_PasswordFormsVisible(routing_id_, password_forms));
+ else
+ Send(new ViewHostMsg_PasswordFormsFound(routing_id_, password_forms));
}
void RenderView::Print(WebFrame* frame, bool script_initiated) {
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698