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

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

Issue 13264002: Requery the autofill server when forms and input fields are dynamically added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename some things, move around others Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RENDERER_AUTOFILL_AGENT_H_ 5 #ifndef COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_
6 #define COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ 6 #define COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "components/autofill/common/forms_seen_param.h"
16 #include "components/autofill/renderer/form_cache.h" 17 #include "components/autofill/renderer/form_cache.h"
17 #include "components/autofill/renderer/page_click_listener.h" 18 #include "components/autofill/renderer/page_click_listener.h"
18 #include "content/public/renderer/render_view_observer.h" 19 #include "content/public/renderer/render_view_observer.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
22 23
23 struct FormFieldData; 24 struct FormFieldData;
24 25
25 namespace WebKit { 26 namespace WebKit {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const WebKit::WebInputElement& element) OVERRIDE; 97 const WebKit::WebInputElement& element) OVERRIDE;
97 virtual void textFieldDidChange( 98 virtual void textFieldDidChange(
98 const WebKit::WebInputElement& element) OVERRIDE; 99 const WebKit::WebInputElement& element) OVERRIDE;
99 virtual void textFieldDidReceiveKeyDown( 100 virtual void textFieldDidReceiveKeyDown(
100 const WebKit::WebInputElement& element, 101 const WebKit::WebInputElement& element,
101 const WebKit::WebKeyboardEvent& event) OVERRIDE; 102 const WebKit::WebKeyboardEvent& event) OVERRIDE;
102 virtual void didRequestAutocomplete( 103 virtual void didRequestAutocomplete(
103 WebKit::WebFrame* frame, 104 WebKit::WebFrame* frame,
104 const WebKit::WebFormElement& form) OVERRIDE; 105 const WebKit::WebFormElement& form) OVERRIDE;
105 virtual void setIgnoreTextChanges(bool ignore) OVERRIDE; 106 virtual void setIgnoreTextChanges(bool ignore) OVERRIDE;
107 virtual void didAssociateFormControls(
108 const WebKit::WebVector<WebKit::WebNode>& nodes) OVERRIDE;
106 109
107 void OnSuggestionsReturned(int query_id, 110 void OnSuggestionsReturned(int query_id,
108 const std::vector<string16>& values, 111 const std::vector<string16>& values,
109 const std::vector<string16>& labels, 112 const std::vector<string16>& labels,
110 const std::vector<string16>& icons, 113 const std::vector<string16>& icons,
111 const std::vector<int>& unique_ids); 114 const std::vector<int>& unique_ids);
112 void OnFormDataFilled(int query_id, const FormData& form); 115 void OnFormDataFilled(int query_id, const FormData& form);
113 void OnFieldTypePredictionsAvailable( 116 void OnFieldTypePredictionsAvailable(
114 const std::vector<FormDataPredictions>& forms); 117 const std::vector<FormDataPredictions>& forms);
115 118
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 202
200 // Set |node| to display the given |value|. 203 // Set |node| to display the given |value|.
201 void SetNodeText(const string16& value, WebKit::WebInputElement* node); 204 void SetNodeText(const string16& value, WebKit::WebInputElement* node);
202 205
203 // Hides any currently showing Autofill UI in the renderer or browser. 206 // Hides any currently showing Autofill UI in the renderer or browser.
204 void HideAutofillUi(); 207 void HideAutofillUi();
205 208
206 // Hides any currently showing Autofill UI in the browser only. 209 // Hides any currently showing Autofill UI in the browser only.
207 void HideHostAutofillUi(); 210 void HideHostAutofillUi();
208 211
212 void MaybeSendDynamicFormsSeen();
213
209 FormCache form_cache_; 214 FormCache form_cache_;
210 215
211 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. 216 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference.
212 217
213 // The ID of the last request sent for form field Autofill. Used to ignore 218 // The ID of the last request sent for form field Autofill. Used to ignore
214 // out of date responses. 219 // out of date responses.
215 int autofill_query_id_; 220 int autofill_query_id_;
216 221
217 // The element corresponding to the last request sent for form field Autofill. 222 // The element corresponding to the last request sent for form field Autofill.
218 WebKit::WebInputElement element_; 223 WebKit::WebInputElement element_;
(...skipping 30 matching lines...) Expand all
249 // Watchdog timer for clicking in Autocheckout flows. 254 // Watchdog timer for clicking in Autocheckout flows.
250 base::OneShotTimer<AutofillAgent> click_timer_; 255 base::OneShotTimer<AutofillAgent> click_timer_;
251 256
252 // Used to signal that we need to watch for loading failures in an 257 // Used to signal that we need to watch for loading failures in an
253 // Autocheckout flow. 258 // Autocheckout flow.
254 bool autocheckout_click_in_progress_; 259 bool autocheckout_click_in_progress_;
255 260
256 // Whether or not |topmost_frame_| is whitelisted for Autocheckout. 261 // Whether or not |topmost_frame_| is whitelisted for Autocheckout.
257 bool is_whitelisted_for_autocheckout_; 262 bool is_whitelisted_for_autocheckout_;
258 263
264 // Whether or not new forms/fields have been dynamically added
265 // since the last time AutofillManager was sent form info.
Ilya Sherman 2013/04/09 02:17:46 nit: Something like "since the last loaded forms w
Dane Wallinga 2013/04/10 00:19:13 Done.
266 bool has_new_forms_for_manager_;
Ilya Sherman 2013/04/09 02:17:46 nit: has_new_forms_for_browser_
Dane Wallinga 2013/04/10 00:19:13 Done.
267
259 // Whether or not to ignore text changes. Useful for when we're committing 268 // Whether or not to ignore text changes. Useful for when we're committing
260 // a composition when we are defocusing the WebView and we don't want to 269 // a composition when we are defocusing the WebView and we don't want to
261 // trigger an autofill popup to show. 270 // trigger an autofill popup to show.
262 bool ignore_text_changes_; 271 bool ignore_text_changes_;
263 272
264 // Timestamp of first time forms are seen. 273 // Timestamp of first time forms are seen.
265 base::TimeTicks forms_seen_timestamp_; 274 base::TimeTicks forms_seen_timestamp_;
266 275
267 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; 276 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
268 277
269 friend class PasswordAutofillAgentTest; 278 friend class PasswordAutofillAgentTest;
270 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement); 279 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement);
271 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms); 280 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms);
281 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendDynamicForms);
272 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, ShowAutofillWarning); 282 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, ShowAutofillWarning);
273 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); 283 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername);
274 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); 284 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept);
275 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); 285 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect);
276 286
277 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); 287 DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
278 }; 288 };
279 289
280 } // namespace autofill 290 } // namespace autofill
281 291
282 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ 292 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_
OLDNEW
« no previous file with comments | « components/autofill/common/forms_seen_param.h ('k') | components/autofill/renderer/autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698