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