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

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

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 685
686 //////////////////////////////////////////////////////////////////////////////// 686 ////////////////////////////////////////////////////////////////////////////////
687 // PasswordAutofillAgent, public: 687 // PasswordAutofillAgent, public:
688 688
689 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame) 689 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame)
690 : content::RenderFrameObserver(render_frame), 690 : content::RenderFrameObserver(render_frame),
691 legacy_(render_frame->GetRenderView(), this), 691 legacy_(render_frame->GetRenderView(), this),
692 logging_state_active_(false), 692 logging_state_active_(false),
693 was_username_autofilled_(false), 693 was_username_autofilled_(false),
694 was_password_autofilled_(false), 694 was_password_autofilled_(false),
695 did_stop_loading_(false),
696 weak_ptr_factory_(this) { 695 weak_ptr_factory_(this) {
697 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id())); 696 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id()));
698 } 697 }
699 698
700 PasswordAutofillAgent::~PasswordAutofillAgent() { 699 PasswordAutofillAgent::~PasswordAutofillAgent() {
701 } 700 }
702 701
703 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() 702 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper()
704 : was_user_gesture_seen_(false) { 703 : was_user_gesture_seen_(false) {
705 } 704 }
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1089 }
1091 1090
1092 if (password_forms.empty() && !only_visible) { 1091 if (password_forms.empty() && !only_visible) {
1093 // We need to send the PasswordFormsRendered message regardless of whether 1092 // We need to send the PasswordFormsRendered message regardless of whether
1094 // there are any forms visible, as this is also the code path that triggers 1093 // there are any forms visible, as this is also the code path that triggers
1095 // showing the infobar. 1094 // showing the infobar.
1096 return; 1095 return;
1097 } 1096 }
1098 1097
1099 if (only_visible) { 1098 if (only_visible) {
1100 Send(new AutofillHostMsg_PasswordFormsRendered(routing_id(), 1099 bool is_last_load = true;
1101 password_forms, 1100 for (blink::WebFrame* frame = render_frame()->GetWebFrame()->top(); frame;
1102 did_stop_loading_)); 1101 frame = frame->traverseNext(false)) {
1102 if (frame != render_frame()->GetWebFrame() && frame->isLoading()) {
Nate Chapin 2015/10/06 18:35:36 This is kind of gross, and necessary because didSt
dcheng 2015/10/08 05:34:35 "didStopLoading does the same thing [no other navi
Nate Chapin 2015/10/08 21:03:59 It was checking all frames. The message blink send
dcheng 2015/10/09 18:34:01 Hmm... but when this is called, the entire page mi
Nate Chapin 2015/10/09 18:39:44 This callback is called for each DidFinishLoad. is
dcheng 2015/10/09 18:45:26 Hmm. I'm thinking of the OOPI case: subframe rende
1103 is_last_load = false;
1104 break;
1105 }
1106 }
1107 Send(new AutofillHostMsg_PasswordFormsRendered(routing_id(), password_forms,
1108 is_last_load));
1103 } else { 1109 } else {
1104 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms)); 1110 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms));
1105 } 1111 }
1106 } 1112 }
1107 1113
1108 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { 1114 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) {
1109 bool handled = true; 1115 bool handled = true;
1110 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) 1116 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message)
1111 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) 1117 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm)
1112 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState) 1118 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState)
(...skipping 25 matching lines...) Expand all
1138 FrameClosing(); 1144 FrameClosing();
1139 } 1145 }
1140 1146
1141 void PasswordAutofillAgent::DidCommitProvisionalLoad( 1147 void PasswordAutofillAgent::DidCommitProvisionalLoad(
1142 bool is_new_navigation, bool is_same_page_navigation) { 1148 bool is_new_navigation, bool is_same_page_navigation) {
1143 if (is_same_page_navigation) { 1149 if (is_same_page_navigation) {
1144 OnSamePageNavigationCompleted(); 1150 OnSamePageNavigationCompleted();
1145 } 1151 }
1146 } 1152 }
1147 1153
1148 void PasswordAutofillAgent::DidStartLoading() {
1149 did_stop_loading_ = false;
1150 }
1151
1152 void PasswordAutofillAgent::DidStopLoading() {
1153 did_stop_loading_ = true;
1154 }
1155
1156 void PasswordAutofillAgent::FrameDetached() { 1154 void PasswordAutofillAgent::FrameDetached() {
1157 // If a sub frame has been destroyed while the user was entering information 1155 // If a sub frame has been destroyed while the user was entering information
1158 // into a password form, try to save the data. See https://crbug.com/450806 1156 // into a password form, try to save the data. See https://crbug.com/450806
1159 // for examples of sites that perform login using this technique. 1157 // for examples of sites that perform login using this technique.
1160 if (render_frame()->GetWebFrame()->parent() && 1158 if (render_frame()->GetWebFrame()->parent() &&
1161 ProvisionallySavedPasswordIsValid()) { 1159 ProvisionallySavedPasswordIsValid()) {
1162 Send(new AutofillHostMsg_InPageNavigation(routing_id(), 1160 Send(new AutofillHostMsg_InPageNavigation(routing_id(),
1163 *provisionally_saved_form_)); 1161 *provisionally_saved_form_));
1164 } 1162 }
1165 FrameClosing(); 1163 FrameClosing();
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 } 1552 }
1555 1553
1556 PasswordAutofillAgent::LegacyPasswordAutofillAgent:: 1554 PasswordAutofillAgent::LegacyPasswordAutofillAgent::
1557 ~LegacyPasswordAutofillAgent() { 1555 ~LegacyPasswordAutofillAgent() {
1558 } 1556 }
1559 1557
1560 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::OnDestruct() { 1558 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::OnDestruct() {
1561 // No op. Do not delete |this|. 1559 // No op. Do not delete |this|.
1562 } 1560 }
1563 1561
1564 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStartLoading() {
1565 agent_->DidStartLoading();
1566 }
1567
1568 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() {
1569 agent_->DidStopLoading();
1570 }
1571
1572 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: 1562 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::
1573 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { 1563 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) {
1574 agent_->LegacyDidStartProvisionalLoad(navigated_frame); 1564 agent_->LegacyDidStartProvisionalLoad(navigated_frame);
1575 } 1565 }
1576 1566
1577 } // namespace autofill 1567 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698