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

Unified Diff: components/autofill/content/renderer/autofill_agent.h

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
Index: components/autofill/content/renderer/autofill_agent.h
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h
index 768d7f6ea89f2d80b0a1acc7e400fc8ff2137137..896a7aca2bc182ef6c2a000e4bcf2c1cf4888093 100644
--- a/components/autofill/content/renderer/autofill_agent.h
+++ b/components/autofill/content/renderer/autofill_agent.h
@@ -14,6 +14,8 @@
#include "base/time/time.h"
#include "components/autofill/content/renderer/form_cache.h"
#include "components/autofill/content/renderer/page_click_listener.h"
+#include "components/autofill/content/renderer/page_click_tracker.h"
+#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebAutofillClient.h"
#include "third_party/WebKit/public/web/WebFormControlElement.h"
@@ -34,39 +36,64 @@ class PasswordAutofillAgent;
class PasswordGenerationAgent;
// AutofillAgent deals with Autofill related communications between WebKit and
-// the browser. There is one AutofillAgent per RenderView.
-// This code was originally part of RenderView.
+// the browser. There is one AutofillAgent per RenderFrame.
// Note that Autofill encompasses:
// - single text field suggestions, that we usually refer to as Autocomplete,
// - password form fill, refered to as Password Autofill, and
// - entire form fill based on one field entry, referred to as Form Autofill.
-class AutofillAgent : public content::RenderViewObserver,
+class AutofillAgent : public content::RenderFrameObserver,
public PageClickListener,
public blink::WebAutofillClient {
public:
// PasswordAutofillAgent is guaranteed to outlive AutofillAgent.
// PasswordGenerationAgent may be NULL. If it is not, then it is also
// guaranteed to outlive AutofillAgent.
- AutofillAgent(content::RenderView* render_view,
+ AutofillAgent(content::RenderFrame* render_frame,
PasswordAutofillAgent* password_autofill_manager,
PasswordGenerationAgent* password_generation_agent);
virtual ~AutofillAgent();
private:
- // content::RenderViewObserver:
+ // Thunk class for RenderViewObserver methods that haven't yet been migrated
+ // to RenderFrameObserver. Should eventually be removed.
vabr (Chromium) 2014/11/10 14:34:39 nit: Bug reference to track the progress of moving
Evan Stade 2014/11/14 23:25:49 Done.
+ class LegacyAutofillAgent : public content::RenderViewObserver {
+ public:
+ LegacyAutofillAgent(content::RenderView* render_view, AutofillAgent* agent);
+ ~LegacyAutofillAgent() override;
+
+ private:
+ // content::RenderViewObserver:
+ void OnDestruct() override;
+ void FrameDetached(blink::WebFrame* frame) override;
+ void WillSubmitForm(blink::WebLocalFrame* frame,
+ const blink::WebFormElement& form) override;
+ void DidChangeScrollOffset(blink::WebLocalFrame* frame) override;
+ void FocusedNodeChanged(const blink::WebNode& node) override;
+ void OrientationChangeEvent() override;
+ void Resized() override;
+
+ AutofillAgent* agent_;
+
+ DISALLOW_COPY_AND_ASSIGN(LegacyAutofillAgent);
+ };
+ friend class LegacyAutofillAgent;
+
+ // content::RenderFrameObserver:
bool OnMessageReceived(const IPC::Message& message) override;
- void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override;
- void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
- bool is_new_navigation) override;
- void FrameDetached(blink::WebFrame* frame) override;
- void FrameWillClose(blink::WebFrame* frame) override;
+ void DidCommitProvisionalLoad(bool is_new_navigation) override;
+ void DidFinishDocumentLoad() override;
+ void FrameWillClose() override;
+
+ // Pass-throughs from LegacyAutofillAgent. These correlate with
+ // RenderViewObserver methods.
+ void FrameDetached(blink::WebFrame* frame);
void WillSubmitForm(blink::WebLocalFrame* frame,
- const blink::WebFormElement& form) override;
- void DidChangeScrollOffset(blink::WebLocalFrame* frame) override;
- void FocusedNodeChanged(const blink::WebNode& node) override;
- void OrientationChangeEvent() override;
- void Resized() override;
+ const blink::WebFormElement& form);
+ void DidChangeScrollOffset(blink::WebLocalFrame* frame);
+ void FocusedNodeChanged(const blink::WebNode& node);
+ void OrientationChangeEvent();
+ void Resized();
// PageClickListener:
void FormControlElementClicked(const blink::WebFormControlElement& element,
@@ -173,8 +200,8 @@ class AutofillAgent : public content::RenderViewObserver,
void PreviewFieldWithValue(const base::string16& value,
blink::WebInputElement* node);
- // Notifies browser of new fillable forms in |frame|.
- void ProcessForms(const blink::WebLocalFrame& frame);
+ // Notifies browser of new fillable forms in |render_frame|.
+ void ProcessForms();
// Hides any currently showing Autofill popup.
void HidePopup();
@@ -184,6 +211,12 @@ class AutofillAgent : public content::RenderViewObserver,
PasswordAutofillAgent* password_autofill_agent_; // Weak reference.
PasswordGenerationAgent* password_generation_agent_; // Weak reference.
+ // Passes through RenderViewObserver methods to |this|.
+ LegacyAutofillAgent legacy_;
+
+ // Tracks clicks on the RenderViewHost, informs |this|.
+ PageClickTracker page_click_tracker_;
+
// The ID of the last request sent for form field Autofill. Used to ignore
// out of date responses.
int autofill_query_id_;
@@ -194,9 +227,6 @@ class AutofillAgent : public content::RenderViewObserver,
// The form element currently requesting an interactive autocomplete.
blink::WebFormElement in_flight_request_form_;
- // Pointer to the WebView. Used to access page scale factor.
- blink::WebView* web_view_;
-
// Should we display a warning if autofill is disabled?
bool display_warning_if_disabled_;

Powered by Google App Engine
This is Rietveld 408576698