| OLD | NEW |
| 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/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 binding_.Bind(std::move(request)); | 175 binding_.Bind(std::move(request)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool AutofillAgent::FormDataCompare::operator()(const FormData& lhs, | 178 bool AutofillAgent::FormDataCompare::operator()(const FormData& lhs, |
| 179 const FormData& rhs) const { | 179 const FormData& rhs) const { |
| 180 return std::tie(lhs.name, lhs.origin, lhs.action, lhs.is_form_tag) < | 180 return std::tie(lhs.name, lhs.origin, lhs.action, lhs.is_form_tag) < |
| 181 std::tie(rhs.name, rhs.origin, rhs.action, rhs.is_form_tag); | 181 std::tie(rhs.name, rhs.origin, rhs.action, rhs.is_form_tag); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void AutofillAgent::DidCommitProvisionalLoad(bool is_new_navigation, | 184 void AutofillAgent::DidCommitProvisionalLoad(bool is_new_navigation, |
| 185 bool is_same_page_navigation) { | 185 bool is_same_document_navigation) { |
| 186 blink::WebFrame* frame = render_frame()->GetWebFrame(); | 186 blink::WebFrame* frame = render_frame()->GetWebFrame(); |
| 187 // TODO(dvadym): check if we need to check if it is main frame navigation | 187 // TODO(dvadym): check if we need to check if it is main frame navigation |
| 188 // http://crbug.com/443155 | 188 // http://crbug.com/443155 |
| 189 if (frame->parent()) | 189 if (frame->parent()) |
| 190 return; // Not a top-level navigation. | 190 return; // Not a top-level navigation. |
| 191 | 191 |
| 192 if (is_same_page_navigation) { | 192 if (is_same_document_navigation) { |
| 193 OnSamePageNavigationCompleted(); | 193 OnSameDocumentNavigationCompleted(); |
| 194 } else { | 194 } else { |
| 195 // Navigation to a new page or a page refresh. | 195 // Navigation to a new page or a page refresh. |
| 196 form_cache_.Reset(); | 196 form_cache_.Reset(); |
| 197 submitted_forms_.clear(); | 197 submitted_forms_.clear(); |
| 198 last_interacted_form_.reset(); | 198 last_interacted_form_.reset(); |
| 199 formless_elements_user_edited_.clear(); | 199 formless_elements_user_edited_.clear(); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void AutofillAgent::DidFinishDocumentLoad() { | 203 void AutofillAgent::DidFinishDocumentLoad() { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 571 } |
| 572 | 572 |
| 573 void AutofillAgent::ShowNotSecureWarning( | 573 void AutofillAgent::ShowNotSecureWarning( |
| 574 const blink::WebInputElement& element) { | 574 const blink::WebInputElement& element) { |
| 575 if (is_generation_popup_possibly_visible_) | 575 if (is_generation_popup_possibly_visible_) |
| 576 return; | 576 return; |
| 577 password_autofill_agent_->ShowNotSecureWarning(element); | 577 password_autofill_agent_->ShowNotSecureWarning(element); |
| 578 is_popup_possibly_visible_ = true; | 578 is_popup_possibly_visible_ = true; |
| 579 } | 579 } |
| 580 | 580 |
| 581 void AutofillAgent::OnSamePageNavigationCompleted() { | 581 void AutofillAgent::OnSameDocumentNavigationCompleted() { |
| 582 if (last_interacted_form_.isNull()) { | 582 if (last_interacted_form_.isNull()) { |
| 583 // If no last interacted form is available (i.e., there is no form tag), | 583 // If no last interacted form is available (i.e., there is no form tag), |
| 584 // we check if all the elements the user has interacted with are gone, | 584 // we check if all the elements the user has interacted with are gone, |
| 585 // to decide if submission has occurred. | 585 // to decide if submission has occurred. |
| 586 if (formless_elements_user_edited_.size() == 0 || | 586 if (formless_elements_user_edited_.size() == 0 || |
| 587 form_util::IsSomeControlElementVisible(formless_elements_user_edited_)) | 587 form_util::IsSomeControlElementVisible(formless_elements_user_edited_)) |
| 588 return; | 588 return; |
| 589 | 589 |
| 590 FormData constructed_form; | 590 FormData constructed_form; |
| 591 if (CollectFormlessElements(&constructed_form)) | 591 if (CollectFormlessElements(&constructed_form)) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // up with a partially parsed form. | 773 // up with a partially parsed form. |
| 774 if (frame && !frame->isLoading()) { | 774 if (frame && !frame->isLoading()) { |
| 775 ProcessForms(); | 775 ProcessForms(); |
| 776 password_autofill_agent_->OnDynamicFormsSeen(); | 776 password_autofill_agent_->OnDynamicFormsSeen(); |
| 777 if (password_generation_agent_) | 777 if (password_generation_agent_) |
| 778 password_generation_agent_->OnDynamicFormsSeen(); | 778 password_generation_agent_->OnDynamicFormsSeen(); |
| 779 } | 779 } |
| 780 } | 780 } |
| 781 | 781 |
| 782 void AutofillAgent::ajaxSucceeded() { | 782 void AutofillAgent::ajaxSucceeded() { |
| 783 OnSamePageNavigationCompleted(); | 783 OnSameDocumentNavigationCompleted(); |
| 784 password_autofill_agent_->AJAXSucceeded(); | 784 password_autofill_agent_->AJAXSucceeded(); |
| 785 } | 785 } |
| 786 | 786 |
| 787 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { | 787 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { |
| 788 if (!autofill_driver_) { | 788 if (!autofill_driver_) { |
| 789 render_frame()->GetRemoteInterfaces()->GetInterface( | 789 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 790 mojo::MakeRequest(&autofill_driver_)); | 790 mojo::MakeRequest(&autofill_driver_)); |
| 791 } | 791 } |
| 792 | 792 |
| 793 return autofill_driver_; | 793 return autofill_driver_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 817 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 817 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 818 // No-op. Don't delete |this|. | 818 // No-op. Don't delete |this|. |
| 819 } | 819 } |
| 820 | 820 |
| 821 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 821 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 822 if (agent_) | 822 if (agent_) |
| 823 agent_->FocusChangeComplete(); | 823 agent_->FocusChangeComplete(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 } // namespace autofill | 826 } // namespace autofill |
| OLD | NEW |