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

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: Fix WebFrameTest.CallbackOrdering race 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 //////////////////////////////////////////////////////////////////////////////// 622 ////////////////////////////////////////////////////////////////////////////////
623 // PasswordAutofillAgent, public: 623 // PasswordAutofillAgent, public:
624 624
625 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame) 625 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame)
626 : content::RenderFrameObserver(render_frame), 626 : content::RenderFrameObserver(render_frame),
627 legacy_(render_frame->GetRenderView(), this), 627 legacy_(render_frame->GetRenderView(), this),
628 logging_state_active_(false), 628 logging_state_active_(false),
629 was_username_autofilled_(false), 629 was_username_autofilled_(false),
630 was_password_autofilled_(false), 630 was_password_autofilled_(false),
631 did_stop_loading_(false),
632 weak_ptr_factory_(this) { 631 weak_ptr_factory_(this) {
633 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id())); 632 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id()));
634 } 633 }
635 634
636 PasswordAutofillAgent::~PasswordAutofillAgent() { 635 PasswordAutofillAgent::~PasswordAutofillAgent() {
637 } 636 }
638 637
639 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() 638 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper()
640 : was_user_gesture_seen_(false) { 639 : was_user_gesture_seen_(false) {
641 } 640 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 } 1033 }
1035 1034
1036 if (password_forms.empty() && !only_visible) { 1035 if (password_forms.empty() && !only_visible) {
1037 // We need to send the PasswordFormsRendered message regardless of whether 1036 // We need to send the PasswordFormsRendered message regardless of whether
1038 // there are any forms visible, as this is also the code path that triggers 1037 // there are any forms visible, as this is also the code path that triggers
1039 // showing the infobar. 1038 // showing the infobar.
1040 return; 1039 return;
1041 } 1040 }
1042 1041
1043 if (only_visible) { 1042 if (only_visible) {
1044 Send(new AutofillHostMsg_PasswordFormsRendered(routing_id(), 1043 bool is_last_load = true;
1045 password_forms, 1044 for (blink::WebFrame* frame = render_frame()->GetWebFrame()->top(); frame;
1046 did_stop_loading_)); 1045 frame = frame->traverseNext(false)) {
1046 if (frame != render_frame()->GetWebFrame() && frame->isLoading()) {
1047 is_last_load = false;
1048 break;
1049 }
1050 }
1051 Send(new AutofillHostMsg_PasswordFormsRendered(routing_id(), password_forms,
1052 is_last_load));
1047 } else { 1053 } else {
1048 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms)); 1054 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms));
1049 } 1055 }
1050 } 1056 }
1051 1057
1052 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { 1058 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) {
1053 bool handled = true; 1059 bool handled = true;
1054 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) 1060 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message)
1055 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) 1061 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm)
1056 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState) 1062 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState)
(...skipping 25 matching lines...) Expand all
1082 FrameClosing(); 1088 FrameClosing();
1083 } 1089 }
1084 1090
1085 void PasswordAutofillAgent::DidCommitProvisionalLoad( 1091 void PasswordAutofillAgent::DidCommitProvisionalLoad(
1086 bool is_new_navigation, bool is_same_page_navigation) { 1092 bool is_new_navigation, bool is_same_page_navigation) {
1087 if (is_same_page_navigation) { 1093 if (is_same_page_navigation) {
1088 OnSamePageNavigationCompleted(); 1094 OnSamePageNavigationCompleted();
1089 } 1095 }
1090 } 1096 }
1091 1097
1092 void PasswordAutofillAgent::DidStartLoading() {
1093 did_stop_loading_ = false;
1094 }
1095
1096 void PasswordAutofillAgent::DidStopLoading() {
1097 did_stop_loading_ = true;
1098 }
1099
1100 void PasswordAutofillAgent::FrameDetached() { 1098 void PasswordAutofillAgent::FrameDetached() {
1101 // If a sub frame has been destroyed while the user was entering information 1099 // If a sub frame has been destroyed while the user was entering information
1102 // into a password form, try to save the data. See https://crbug.com/450806 1100 // into a password form, try to save the data. See https://crbug.com/450806
1103 // for examples of sites that perform login using this technique. 1101 // for examples of sites that perform login using this technique.
1104 if (render_frame()->GetWebFrame()->parent() && 1102 if (render_frame()->GetWebFrame()->parent() &&
1105 ProvisionallySavedPasswordIsValid()) { 1103 ProvisionallySavedPasswordIsValid()) {
1106 Send(new AutofillHostMsg_InPageNavigation(routing_id(), 1104 Send(new AutofillHostMsg_InPageNavigation(routing_id(),
1107 *provisionally_saved_form_)); 1105 *provisionally_saved_form_));
1108 } 1106 }
1109 FrameClosing(); 1107 FrameClosing();
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 } 1496 }
1499 1497
1500 PasswordAutofillAgent::LegacyPasswordAutofillAgent:: 1498 PasswordAutofillAgent::LegacyPasswordAutofillAgent::
1501 ~LegacyPasswordAutofillAgent() { 1499 ~LegacyPasswordAutofillAgent() {
1502 } 1500 }
1503 1501
1504 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::OnDestruct() { 1502 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::OnDestruct() {
1505 // No op. Do not delete |this|. 1503 // No op. Do not delete |this|.
1506 } 1504 }
1507 1505
1508 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStartLoading() {
1509 agent_->DidStartLoading();
1510 }
1511
1512 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() {
1513 agent_->DidStopLoading();
1514 }
1515
1516 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: 1506 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::
1517 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { 1507 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) {
1518 agent_->LegacyDidStartProvisionalLoad(navigated_frame); 1508 agent_->LegacyDidStartProvisionalLoad(navigated_frame);
1519 } 1509 }
1520 1510
1521 } // namespace autofill 1511 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698