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

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

Issue 2766053002: [refactor] Fix autofill features for payments when the form is inside an OOPIF (Closed)
Patch Set: Using Node& instead of Node* Created 3 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 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/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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 show_password_suggestions_only(false) { 140 show_password_suggestions_only(false) {
141 } 141 }
142 142
143 AutofillAgent::AutofillAgent(content::RenderFrame* render_frame, 143 AutofillAgent::AutofillAgent(content::RenderFrame* render_frame,
144 PasswordAutofillAgent* password_autofill_agent, 144 PasswordAutofillAgent* password_autofill_agent,
145 PasswordGenerationAgent* password_generation_agent) 145 PasswordGenerationAgent* password_generation_agent)
146 : content::RenderFrameObserver(render_frame), 146 : content::RenderFrameObserver(render_frame),
147 form_cache_(*render_frame->GetWebFrame()), 147 form_cache_(*render_frame->GetWebFrame()),
148 password_autofill_agent_(password_autofill_agent), 148 password_autofill_agent_(password_autofill_agent),
149 password_generation_agent_(password_generation_agent), 149 password_generation_agent_(password_generation_agent),
150 legacy_(render_frame->GetRenderView(), this),
151 autofill_query_id_(0), 150 autofill_query_id_(0),
152 was_query_node_autofilled_(false), 151 was_query_node_autofilled_(false),
153 ignore_text_changes_(false), 152 ignore_text_changes_(false),
154 is_popup_possibly_visible_(false), 153 is_popup_possibly_visible_(false),
155 is_generation_popup_possibly_visible_(false), 154 is_generation_popup_possibly_visible_(false),
156 binding_(this), 155 binding_(this),
157 weak_ptr_factory_(this) { 156 weak_ptr_factory_(this) {
158 render_frame->GetWebFrame()->setAutofillClient(this); 157 render_frame->GetWebFrame()->setAutofillClient(this);
159 password_autofill_agent->SetAutofillAgent(this); 158 password_autofill_agent->SetAutofillAgent(this);
160 159
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 submitted_forms_.insert(form_data); 272 submitted_forms_.insert(form_data);
274 } 273 }
275 274
276 if (form_submitted) { 275 if (form_submitted) {
277 GetAutofillDriver()->FormSubmitted(form_data); 276 GetAutofillDriver()->FormSubmitted(form_data);
278 } 277 }
279 } 278 }
280 279
281 void AutofillAgent::Shutdown() { 280 void AutofillAgent::Shutdown() {
282 binding_.Close(); 281 binding_.Close();
283 legacy_.Shutdown();
284 weak_ptr_factory_.InvalidateWeakPtrs(); 282 weak_ptr_factory_.InvalidateWeakPtrs();
285 } 283 }
286 284
287 void AutofillAgent::FocusChangeComplete() { 285 void AutofillAgent::DidCompleteFocusChangeInFrame() {
288 WebDocument doc = render_frame()->GetWebFrame()->document(); 286 WebDocument doc = render_frame()->GetWebFrame()->document();
289 WebElement focused_element; 287 WebElement focused_element;
290 if (!doc.isNull()) 288 if (!doc.isNull())
291 focused_element = doc.focusedElement(); 289 focused_element = doc.focusedElement();
292 // PasswordGenerationAgent needs to know about focus changes, even if there is 290 // PasswordGenerationAgent needs to know about focus changes, even if there is
293 // no focused element. 291 // no focused element.
294 if (password_generation_agent_ && 292 if (password_generation_agent_ &&
295 password_generation_agent_->FocusedNodeHasChanged(focused_element)) { 293 password_generation_agent_->FocusedNodeHasChanged(focused_element)) {
296 is_generation_popup_possibly_visible_ = true; 294 is_generation_popup_possibly_visible_ = true;
297 is_popup_possibly_visible_ = true; 295 is_popup_possibly_visible_ = true;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 790
793 return autofill_driver_; 791 return autofill_driver_;
794 } 792 }
795 793
796 const mojom::PasswordManagerDriverPtr& 794 const mojom::PasswordManagerDriverPtr&
797 AutofillAgent::GetPasswordManagerDriver() { 795 AutofillAgent::GetPasswordManagerDriver() {
798 DCHECK(password_autofill_agent_); 796 DCHECK(password_autofill_agent_);
799 return password_autofill_agent_->GetPasswordManagerDriver(); 797 return password_autofill_agent_->GetPasswordManagerDriver();
800 } 798 }
801 799
802 // LegacyAutofillAgent ---------------------------------------------------------
803
804 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent(
805 content::RenderView* render_view,
806 AutofillAgent* agent)
807 : content::RenderViewObserver(render_view), agent_(agent) {
808 }
809
810 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() {
811 }
812
813 void AutofillAgent::LegacyAutofillAgent::Shutdown() {
814 agent_ = nullptr;
815 }
816
817 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
818 // No-op. Don't delete |this|.
819 }
820
821 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
822 if (agent_)
823 agent_->FocusChangeComplete();
824 }
825
826 } // namespace autofill 800 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698