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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class WebNode; | 25 class WebNode; |
26 class WebView; | 26 class WebView; |
27 } | 27 } |
28 | 28 |
29 namespace autofill { | 29 namespace autofill { |
30 | 30 |
31 struct FormData; | 31 struct FormData; |
32 struct FormFieldData; | 32 struct FormFieldData; |
33 struct WebElementDescriptor; | 33 struct WebElementDescriptor; |
34 class PasswordAutofillAgent; | 34 class PasswordAutofillAgent; |
| 35 class PasswordGenerationAgent; |
35 | 36 |
36 // AutofillAgent deals with Autofill related communications between WebKit and | 37 // AutofillAgent deals with Autofill related communications between WebKit and |
37 // the browser. There is one AutofillAgent per RenderView. | 38 // the browser. There is one AutofillAgent per RenderView. |
38 // This code was originally part of RenderView. | 39 // This code was originally part of RenderView. |
39 // Note that Autofill encompasses: | 40 // Note that Autofill encompasses: |
40 // - single text field suggestions, that we usually refer to as Autocomplete, | 41 // - single text field suggestions, that we usually refer to as Autocomplete, |
41 // - password form fill, refered to as Password Autofill, and | 42 // - password form fill, refered to as Password Autofill, and |
42 // - entire form fill based on one field entry, referred to as Form Autofill. | 43 // - entire form fill based on one field entry, referred to as Form Autofill. |
43 | 44 |
44 class AutofillAgent : public content::RenderViewObserver, | 45 class AutofillAgent : public content::RenderViewObserver, |
45 public PageClickListener, | 46 public PageClickListener, |
46 public blink::WebAutofillClient { | 47 public blink::WebAutofillClient { |
47 public: | 48 public: |
48 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent. | 49 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent. |
| 50 // PasswordGenerationAgent may be NULL. If it is not, then it is also |
| 51 // guaranteed to outlive AutofillAgent. |
49 AutofillAgent(content::RenderView* render_view, | 52 AutofillAgent(content::RenderView* render_view, |
50 PasswordAutofillAgent* password_autofill_manager); | 53 PasswordAutofillAgent* password_autofill_manager, |
| 54 PasswordGenerationAgent* password_generation_agent); |
51 virtual ~AutofillAgent(); | 55 virtual ~AutofillAgent(); |
52 | 56 |
53 private: | 57 private: |
54 enum AutofillAction { | 58 enum AutofillAction { |
55 AUTOFILL_NONE, // No state set. | 59 AUTOFILL_NONE, // No state set. |
56 AUTOFILL_FILL, // Fill the Autofill form data. | 60 AUTOFILL_FILL, // Fill the Autofill form data. |
57 AUTOFILL_PREVIEW, // Preview the Autofill form data. | 61 AUTOFILL_PREVIEW, // Preview the Autofill form data. |
58 }; | 62 }; |
59 | 63 |
60 // RenderView::Observer: | 64 // RenderView::Observer: |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 FormFieldData* field) WARN_UNUSED_RESULT; | 171 FormFieldData* field) WARN_UNUSED_RESULT; |
168 | 172 |
169 // Set |node| to display the given |value|. | 173 // Set |node| to display the given |value|. |
170 void SetNodeText(const base::string16& value, blink::WebInputElement* node); | 174 void SetNodeText(const base::string16& value, blink::WebInputElement* node); |
171 | 175 |
172 // Hides any currently showing Autofill UI. | 176 // Hides any currently showing Autofill UI. |
173 void HideAutofillUI(); | 177 void HideAutofillUI(); |
174 | 178 |
175 FormCache form_cache_; | 179 FormCache form_cache_; |
176 | 180 |
177 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. | 181 PasswordAutofillAgent* password_autofill_agent_; // Weak reference. |
| 182 PasswordGenerationAgent* password_generation_agent_; // Weak reference. |
178 | 183 |
179 // The ID of the last request sent for form field Autofill. Used to ignore | 184 // The ID of the last request sent for form field Autofill. Used to ignore |
180 // out of date responses. | 185 // out of date responses. |
181 int autofill_query_id_; | 186 int autofill_query_id_; |
182 | 187 |
183 // The element corresponding to the last request sent for form field Autofill. | 188 // The element corresponding to the last request sent for form field Autofill. |
184 blink::WebInputElement element_; | 189 blink::WebInputElement element_; |
185 | 190 |
186 // The form element currently requesting an interactive autocomplete. | 191 // The form element currently requesting an interactive autocomplete. |
187 blink::WebFormElement in_flight_request_form_; | 192 blink::WebFormElement in_flight_request_form_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 FRIEND_TEST_ALL_PREFIXES( | 238 FRIEND_TEST_ALL_PREFIXES( |
234 PasswordAutofillAgentTest, | 239 PasswordAutofillAgentTest, |
235 PasswordAutofillTriggersOnChangeEventsWaitForUsername); | 240 PasswordAutofillTriggersOnChangeEventsWaitForUsername); |
236 | 241 |
237 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 242 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
238 }; | 243 }; |
239 | 244 |
240 } // namespace autofill | 245 } // namespace autofill |
241 | 246 |
242 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 247 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
OLD | NEW |