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

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

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 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "components/autofill/content/common/autofill_agent.mojom.h" 16 #include "components/autofill/content/common/autofill_agent.mojom.h"
17 #include "components/autofill/content/common/autofill_driver.mojom.h" 17 #include "components/autofill/content/common/autofill_driver.mojom.h"
18 #include "components/autofill/content/renderer/form_cache.h" 18 #include "components/autofill/content/renderer/form_cache.h"
19 #include "components/autofill/content/renderer/page_click_listener.h" 19 #include "components/autofill/content/renderer/page_click_listener.h"
20 #include "content/public/renderer/render_frame_observer.h" 20 #include "content/public/renderer/render_frame_observer.h"
21 #include "content/public/renderer/render_view_observer.h"
22 #include "mojo/public/cpp/bindings/binding.h" 21 #include "mojo/public/cpp/bindings/binding.h"
23 #include "third_party/WebKit/public/web/WebAutofillClient.h" 22 #include "third_party/WebKit/public/web/WebAutofillClient.h"
24 #include "third_party/WebKit/public/web/WebFormControlElement.h" 23 #include "third_party/WebKit/public/web/WebFormControlElement.h"
25 #include "third_party/WebKit/public/web/WebFormElement.h" 24 #include "third_party/WebKit/public/web/WebFormElement.h"
26 #include "third_party/WebKit/public/web/WebInputElement.h" 25 #include "third_party/WebKit/public/web/WebInputElement.h"
27 26
28 namespace blink { 27 namespace blink {
29 class WebNode; 28 class WebNode;
30 class WebView; 29 class WebView;
31 } 30 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // blink::WebAutofillClient: 88 // blink::WebAutofillClient:
90 void didAssociateFormControlsDynamically() override; 89 void didAssociateFormControlsDynamically() override;
91 90
92 private: 91 private:
93 // Functor used as a simplified comparison function for FormData. Only 92 // Functor used as a simplified comparison function for FormData. Only
94 // compares forms at a high level (notably name, origin, action). 93 // compares forms at a high level (notably name, origin, action).
95 struct FormDataCompare { 94 struct FormDataCompare {
96 bool operator()(const FormData& lhs, const FormData& rhs) const; 95 bool operator()(const FormData& lhs, const FormData& rhs) const;
97 }; 96 };
98 97
99 // Thunk class for RenderViewObserver methods that haven't yet been migrated
100 // to RenderFrameObserver. Should eventually be removed.
101 // http://crbug.com/433486
102 class LegacyAutofillAgent : public content::RenderViewObserver {
103 public:
104 LegacyAutofillAgent(content::RenderView* render_view, AutofillAgent* agent);
105 ~LegacyAutofillAgent() override;
106
107 // Shuts the LegacyAutofillAgent down on RenderFrame deletion. Safe to call
108 // multiple times.
109 void Shutdown();
110
111 private:
112 // content::RenderViewObserver:
113 void OnDestruct() override;
114 void FocusChangeComplete() override;
115
116 AutofillAgent* agent_;
117
118 DISALLOW_COPY_AND_ASSIGN(LegacyAutofillAgent);
119 };
120 friend class LegacyAutofillAgent;
121
122 // Flags passed to ShowSuggestions. 98 // Flags passed to ShowSuggestions.
123 struct ShowSuggestionsOptions { 99 struct ShowSuggestionsOptions {
124 // All fields are default initialized to false. 100 // All fields are default initialized to false.
125 ShowSuggestionsOptions(); 101 ShowSuggestionsOptions();
126 102
127 // Specifies that suggestions should be shown when |element| contains no 103 // Specifies that suggestions should be shown when |element| contains no
128 // text. 104 // text.
129 bool autofill_on_empty_values; 105 bool autofill_on_empty_values;
130 106
131 // Specifies that suggestions should be shown when the caret is not 107 // Specifies that suggestions should be shown when the caret is not
(...skipping 16 matching lines...) Expand all
148 }; 124 };
149 125
150 // content::RenderFrameObserver: 126 // content::RenderFrameObserver:
151 void DidCommitProvisionalLoad(bool is_new_navigation, 127 void DidCommitProvisionalLoad(bool is_new_navigation,
152 bool is_same_page_navigation) override; 128 bool is_same_page_navigation) override;
153 void DidFinishDocumentLoad() override; 129 void DidFinishDocumentLoad() override;
154 void WillSendSubmitEvent(const blink::WebFormElement& form) override; 130 void WillSendSubmitEvent(const blink::WebFormElement& form) override;
155 void WillSubmitForm(const blink::WebFormElement& form) override; 131 void WillSubmitForm(const blink::WebFormElement& form) override;
156 void DidChangeScrollOffset() override; 132 void DidChangeScrollOffset() override;
157 void FocusedNodeChanged(const blink::WebNode& node) override; 133 void FocusedNodeChanged(const blink::WebNode& node) override;
134 void DidCompleteFocusChangeInFrame() override;
158 void OnDestruct() override; 135 void OnDestruct() override;
159 136
160 // Fires IPC messages for a given form submission. Will always fire 137 // Fires IPC messages for a given form submission. Will always fire
161 // AutofillHostMsg_WillSubmitForm, and will also fire 138 // AutofillHostMsg_WillSubmitForm, and will also fire
162 // AutofillHostMsg_FormSubmitted if |form_submitted| is true. Respects 139 // AutofillHostMsg_FormSubmitted if |form_submitted| is true. Respects
163 // submitted_forms_ contents to ensure no duplicate submissions of 140 // submitted_forms_ contents to ensure no duplicate submissions of
164 // AutofillHostMsg_WillSubmitForm. 141 // AutofillHostMsg_WillSubmitForm.
165 void FireHostSubmitEvents(const blink::WebFormElement& form, 142 void FireHostSubmitEvents(const blink::WebFormElement& form,
166 bool form_submitted); 143 bool form_submitted);
167 void FireHostSubmitEvents(const FormData& form_data, bool form_submitted); 144 void FireHostSubmitEvents(const FormData& form_data, bool form_submitted);
168 145
169 // Shuts the AutofillAgent down on RenderFrame deletion. Safe to call multiple 146 // Shuts the AutofillAgent down on RenderFrame deletion. Safe to call multiple
170 // times. 147 // times.
171 void Shutdown(); 148 void Shutdown();
172 149
173 // Pass-through from LegacyAutofillAgent. This correlates with the
174 // RenderViewObserver method.
175 void FocusChangeComplete();
176
177 // PageClickListener: 150 // PageClickListener:
178 void FormControlElementClicked(const blink::WebFormControlElement& element, 151 void FormControlElementClicked(const blink::WebFormControlElement& element,
179 bool was_focused) override; 152 bool was_focused) override;
180 153
181 // blink::WebAutofillClient: 154 // blink::WebAutofillClient:
182 void textFieldDidEndEditing(const blink::WebInputElement& element) override; 155 void textFieldDidEndEditing(const blink::WebInputElement& element) override;
183 void textFieldDidChange(const blink::WebFormControlElement& element) override; 156 void textFieldDidChange(const blink::WebFormControlElement& element) override;
184 void textFieldDidReceiveKeyDown( 157 void textFieldDidReceiveKeyDown(
185 const blink::WebInputElement& element, 158 const blink::WebInputElement& element,
186 const blink::WebKeyboardEvent& event) override; 159 const blink::WebKeyboardEvent& event) override;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // frame. 226 // frame.
254 FormCache form_cache_; 227 FormCache form_cache_;
255 228
256 // Keeps track of the forms for which a "will submit" message has been sent in 229 // Keeps track of the forms for which a "will submit" message has been sent in
257 // this frame's current load. We use a simplified comparison function. 230 // this frame's current load. We use a simplified comparison function.
258 std::set<FormData, FormDataCompare> submitted_forms_; 231 std::set<FormData, FormDataCompare> submitted_forms_;
259 232
260 PasswordAutofillAgent* password_autofill_agent_; // Weak reference. 233 PasswordAutofillAgent* password_autofill_agent_; // Weak reference.
261 PasswordGenerationAgent* password_generation_agent_; // Weak reference. 234 PasswordGenerationAgent* password_generation_agent_; // Weak reference.
262 235
263 // Passes through RenderViewObserver methods to |this|.
264 LegacyAutofillAgent legacy_;
265
266 // The ID of the last request sent for form field Autofill. Used to ignore 236 // The ID of the last request sent for form field Autofill. Used to ignore
267 // out of date responses. 237 // out of date responses.
268 int autofill_query_id_; 238 int autofill_query_id_;
269 239
270 // The element corresponding to the last request sent for form field Autofill. 240 // The element corresponding to the last request sent for form field Autofill.
271 blink::WebFormControlElement element_; 241 blink::WebFormControlElement element_;
272 242
273 // The form element currently requesting an interactive autocomplete. 243 // The form element currently requesting an interactive autocomplete.
274 blink::WebFormElement in_flight_request_form_; 244 blink::WebFormElement in_flight_request_form_;
275 245
(...skipping 28 matching lines...) Expand all
304 mojom::AutofillDriverPtr autofill_driver_; 274 mojom::AutofillDriverPtr autofill_driver_;
305 275
306 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; 276 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
307 277
308 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); 278 DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
309 }; 279 };
310 280
311 } // namespace autofill 281 } // namespace autofill
312 282
313 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 283 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/autofill_agent.cc » ('j') | content/public/renderer/render_frame_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698