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