OLD | NEW |
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 <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/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "components/autofill/content/renderer/form_cache.h" | 16 #include "components/autofill/content/renderer/form_cache.h" |
17 #include "components/autofill/content/renderer/page_click_listener.h" | 17 #include "components/autofill/content/renderer/page_click_listener.h" |
| 18 #include "components/autofill/core/common/forms_seen_state.h" |
18 #include "content/public/renderer/render_view_observer.h" | 19 #include "content/public/renderer/render_view_observer.h" |
19 #include "third_party/WebKit/public/web/WebAutofillClient.h" | 20 #include "third_party/WebKit/public/web/WebAutofillClient.h" |
20 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 21 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
21 #include "third_party/WebKit/public/web/WebFormElement.h" | 22 #include "third_party/WebKit/public/web/WebFormElement.h" |
22 #include "third_party/WebKit/public/web/WebInputElement.h" | 23 #include "third_party/WebKit/public/web/WebInputElement.h" |
23 | 24 |
24 namespace blink { | 25 namespace blink { |
25 class WebNode; | 26 class WebNode; |
26 class WebView; | 27 class WebView; |
27 struct WebAutocompleteParams; | 28 struct WebAutocompleteParams; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Set |node| to display the given |value|. | 158 // Set |node| to display the given |value|. |
158 void FillFieldWithValue(const base::string16& value, | 159 void FillFieldWithValue(const base::string16& value, |
159 blink::WebInputElement* node); | 160 blink::WebInputElement* node); |
160 | 161 |
161 // Set |node| to display the given |value| as a preview. The preview is | 162 // Set |node| to display the given |value| as a preview. The preview is |
162 // visible on screen to the user, but not visible to the page via the DOM or | 163 // visible on screen to the user, but not visible to the page via the DOM or |
163 // JavaScript. | 164 // JavaScript. |
164 void PreviewFieldWithValue(const base::string16& value, | 165 void PreviewFieldWithValue(const base::string16& value, |
165 blink::WebInputElement* node); | 166 blink::WebInputElement* node); |
166 | 167 |
167 // Notifies browser of new fillable forms in |frame|. | |
168 void ProcessForms(const blink::WebLocalFrame& frame); | |
169 | |
170 // Hides any currently showing Autofill popup. | 168 // Hides any currently showing Autofill popup. |
171 void HidePopup(); | 169 void HidePopup(); |
172 | 170 |
173 FormCache form_cache_; | 171 FormCache form_cache_; |
174 | 172 |
175 PasswordAutofillAgent* password_autofill_agent_; // Weak reference. | 173 PasswordAutofillAgent* password_autofill_agent_; // Weak reference. |
176 PasswordGenerationAgent* password_generation_agent_; // Weak reference. | 174 PasswordGenerationAgent* password_generation_agent_; // Weak reference. |
177 | 175 |
178 // The ID of the last request sent for form field Autofill. Used to ignore | 176 // The ID of the last request sent for form field Autofill. Used to ignore |
179 // out of date responses. | 177 // out of date responses. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Whether or not to ignore text changes. Useful for when we're committing | 209 // Whether or not to ignore text changes. Useful for when we're committing |
212 // a composition when we are defocusing the WebView and we don't want to | 210 // a composition when we are defocusing the WebView and we don't want to |
213 // trigger an autofill popup to show. | 211 // trigger an autofill popup to show. |
214 bool ignore_text_changes_; | 212 bool ignore_text_changes_; |
215 | 213 |
216 // Whether the Autofill popup is possibly visible. This is tracked as a | 214 // Whether the Autofill popup is possibly visible. This is tracked as a |
217 // performance improvement, so that the IPC channel isn't flooded with | 215 // performance improvement, so that the IPC channel isn't flooded with |
218 // messages to close the Autofill popup when it can't possibly be showing. | 216 // messages to close the Autofill popup when it can't possibly be showing. |
219 bool is_popup_possibly_visible_; | 217 bool is_popup_possibly_visible_; |
220 | 218 |
221 // True if a message has already been sent about forms for the main frame. | 219 // Timestamp of first time forms are seen. |
222 // When the main frame is first loaded, a message is sent even if no forms | 220 base::TimeTicks forms_seen_timestamp_; |
223 // exist in the frame. Otherwise, such messages are supressed. | |
224 bool main_frame_processed_; | |
225 | 221 |
226 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; | 222 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; |
227 | 223 |
228 friend class PasswordAutofillAgentTest; | 224 friend class PasswordAutofillAgentTest; |
229 friend class RequestAutocompleteRendererTest; | 225 friend class RequestAutocompleteRendererTest; |
230 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, FillFormElement); | 226 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, FillFormElement); |
231 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, SendDynamicForms); | 227 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, SendDynamicForms); |
232 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, ShowAutofillWarning); | 228 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, ShowAutofillWarning); |
233 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); | 229 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); |
234 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); | 230 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); |
235 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); | 231 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); |
236 FRIEND_TEST_ALL_PREFIXES( | 232 FRIEND_TEST_ALL_PREFIXES( |
237 PasswordAutofillAgentTest, | 233 PasswordAutofillAgentTest, |
238 PasswordAutofillTriggersOnChangeEventsWaitForUsername); | 234 PasswordAutofillTriggersOnChangeEventsWaitForUsername); |
239 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, | 235 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, |
240 NoCancelOnMainFrameNavigateAfterDone); | 236 NoCancelOnMainFrameNavigateAfterDone); |
241 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, | 237 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, |
242 NoCancelOnSubframeNavigateAfterDone); | 238 NoCancelOnSubframeNavigateAfterDone); |
243 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, | 239 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest, |
244 InvokingTwiceOnlyShowsOnce); | 240 InvokingTwiceOnlyShowsOnce); |
245 | 241 |
246 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 242 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
247 }; | 243 }; |
248 | 244 |
249 } // namespace autofill | 245 } // namespace autofill |
250 | 246 |
251 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 247 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
OLD | NEW |