OLD | NEW |
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_state.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 namespace WebKit { | 24 namespace WebKit { |
24 class WebNode; | 25 class WebNode; |
25 class WebView; | 26 class WebView; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<base::string16>& values, | 111 const std::vector<base::string16>& values, |
109 const std::vector<base::string16>& labels, | 112 const std::vector<base::string16>& labels, |
110 const std::vector<base::string16>& icons, | 113 const std::vector<base::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 Loading... |
199 | 202 |
200 // Set |node| to display the given |value|. | 203 // Set |node| to display the given |value|. |
201 void SetNodeText(const base::string16& value, WebKit::WebInputElement* node); | 204 void SetNodeText(const base::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 // Send |AutofillHostMsg_MaybeShowAutocheckoutBubble| to browser if needed. | 214 // Send |AutofillHostMsg_MaybeShowAutocheckoutBubble| to browser if needed. |
210 void MaybeShowAutocheckoutBubble(); | 215 void MaybeShowAutocheckoutBubble(); |
211 | 216 |
212 FormCache form_cache_; | 217 FormCache form_cache_; |
213 | 218 |
214 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. | 219 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. |
215 | 220 |
216 // The ID of the last request sent for form field Autofill. Used to ignore | 221 // The ID of the last request sent for form field Autofill. Used to ignore |
217 // out of date responses. | 222 // out of date responses. |
218 int autofill_query_id_; | 223 int autofill_query_id_; |
(...skipping 30 matching lines...) Expand all Loading... |
249 // If true we just set the node text so we shouldn't show the popup. | 254 // If true we just set the node text so we shouldn't show the popup. |
250 bool did_set_node_text_; | 255 bool did_set_node_text_; |
251 | 256 |
252 // Watchdog timer for clicking in Autocheckout flows. | 257 // Watchdog timer for clicking in Autocheckout flows. |
253 base::OneShotTimer<AutofillAgent> click_timer_; | 258 base::OneShotTimer<AutofillAgent> click_timer_; |
254 | 259 |
255 // Used to signal that we need to watch for loading failures in an | 260 // Used to signal that we need to watch for loading failures in an |
256 // Autocheckout flow. | 261 // Autocheckout flow. |
257 bool autocheckout_click_in_progress_; | 262 bool autocheckout_click_in_progress_; |
258 | 263 |
| 264 // Whether or not |topmost_frame_| is whitelisted for Autocheckout. |
| 265 bool is_autocheckout_supported_; |
| 266 |
| 267 // Whether or not new forms/fields have been dynamically added |
| 268 // since the last loaded forms were sent to the browser process. |
| 269 bool has_new_forms_for_browser_; |
| 270 |
259 // Whether or not we should try to offer the user Autocheckout functionality | 271 // Whether or not we should try to offer the user Autocheckout functionality |
260 // by sending |AutofillHostMsg_MaybeShowAutocheckoutBubble| to the browser. | 272 // by sending |AutofillHostMsg_MaybeShowAutocheckoutBubble| to the browser. |
261 bool try_to_show_autocheckout_bubble_; | 273 bool try_to_show_autocheckout_bubble_; |
262 | 274 |
263 // Whether or not to ignore text changes. Useful for when we're committing | 275 // Whether or not to ignore text changes. Useful for when we're committing |
264 // a composition when we are defocusing the WebView and we don't want to | 276 // a composition when we are defocusing the WebView and we don't want to |
265 // trigger an autofill popup to show. | 277 // trigger an autofill popup to show. |
266 bool ignore_text_changes_; | 278 bool ignore_text_changes_; |
267 | 279 |
268 // Timestamp of first time forms are seen. | 280 // Timestamp of first time forms are seen. |
269 base::TimeTicks forms_seen_timestamp_; | 281 base::TimeTicks forms_seen_timestamp_; |
270 | 282 |
271 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; | 283 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; |
272 | 284 |
273 friend class PasswordAutofillAgentTest; | 285 friend class PasswordAutofillAgentTest; |
274 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement); | 286 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement); |
275 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms); | 287 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms); |
| 288 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendDynamicForms); |
276 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, ShowAutofillWarning); | 289 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, ShowAutofillWarning); |
277 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); | 290 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); |
278 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); | 291 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); |
279 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); | 292 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); |
280 | 293 |
281 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 294 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
282 }; | 295 }; |
283 | 296 |
284 } // namespace autofill | 297 } // namespace autofill |
285 | 298 |
286 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ | 299 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ |
OLD | NEW |