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 CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 5 #ifndef CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 6 #define CHROME_RENDERER_AUTOFILL_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 "chrome/renderer/autofill/form_cache.h" | 14 #include "chrome/renderer/autofill/form_cache.h" |
15 #include "chrome/renderer/page_click_listener.h" | 15 #include "chrome/renderer/page_click_listener.h" |
16 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/renderer/render_view_observer.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
19 | 19 |
20 namespace webkit { | 20 struct FormFieldData; |
21 namespace forms { | |
22 struct FormData; | |
23 struct FormDataPredictions; | |
24 struct FormField; | |
25 } | |
26 } | |
27 | 21 |
28 namespace WebKit { | 22 namespace WebKit { |
29 class WebNode; | 23 class WebNode; |
30 } | 24 } |
31 | 25 |
32 namespace autofill { | 26 namespace autofill { |
33 | 27 |
34 class PasswordAutofillManager; | 28 class PasswordAutofillManager; |
35 | 29 |
36 // AutofillAgent deals with Autofill related communications between WebKit and | 30 // AutofillAgent deals with Autofill related communications between WebKit and |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 const WebKit::WebInputElement& element) OVERRIDE; | 87 const WebKit::WebInputElement& element) OVERRIDE; |
94 virtual void textFieldDidReceiveKeyDown( | 88 virtual void textFieldDidReceiveKeyDown( |
95 const WebKit::WebInputElement& element, | 89 const WebKit::WebInputElement& element, |
96 const WebKit::WebKeyboardEvent& event) OVERRIDE; | 90 const WebKit::WebKeyboardEvent& event) OVERRIDE; |
97 | 91 |
98 void OnSuggestionsReturned(int query_id, | 92 void OnSuggestionsReturned(int query_id, |
99 const std::vector<string16>& values, | 93 const std::vector<string16>& values, |
100 const std::vector<string16>& labels, | 94 const std::vector<string16>& labels, |
101 const std::vector<string16>& icons, | 95 const std::vector<string16>& icons, |
102 const std::vector<int>& unique_ids); | 96 const std::vector<int>& unique_ids); |
103 void OnFormDataFilled(int query_id, const webkit::forms::FormData& form); | 97 void OnFormDataFilled(int query_id, const FormData& form); |
104 void OnFieldTypePredictionsAvailable( | 98 void OnFieldTypePredictionsAvailable( |
105 const std::vector<webkit::forms::FormDataPredictions>& forms); | 99 const std::vector<FormDataPredictions>& forms); |
106 | 100 |
107 // For external Autofill selection. | 101 // For external Autofill selection. |
108 void OnSelectAutofillSuggestionAtIndex(int listIndex); | 102 void OnSelectAutofillSuggestionAtIndex(int listIndex); |
109 void OnSetAutofillActionFill(); | 103 void OnSetAutofillActionFill(); |
110 void OnClearForm(); | 104 void OnClearForm(); |
111 void OnSetAutofillActionPreview(); | 105 void OnSetAutofillActionPreview(); |
112 void OnClearPreviewedForm(); | 106 void OnClearPreviewedForm(); |
113 void OnSetNodeText(const string16& value); | 107 void OnSetNodeText(const string16& value); |
114 void OnAcceptDataListSuggestion(const string16& value); | 108 void OnAcceptDataListSuggestion(const string16& value); |
115 void OnAcceptPasswordAutofillSuggestion(const string16& value); | 109 void OnAcceptPasswordAutofillSuggestion(const string16& value); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // profile's unique ID. |action| specifies whether to Fill or Preview the | 150 // profile's unique ID. |action| specifies whether to Fill or Preview the |
157 // values returned from the AutofillManager. | 151 // values returned from the AutofillManager. |
158 void FillAutofillFormData(const WebKit::WebNode& node, | 152 void FillAutofillFormData(const WebKit::WebNode& node, |
159 int unique_id, | 153 int unique_id, |
160 AutofillAction action); | 154 AutofillAction action); |
161 | 155 |
162 // Fills |form| and |field| with the FormData and FormField corresponding to | 156 // Fills |form| and |field| with the FormData and FormField corresponding to |
163 // |node|. Returns true if the data was found; and false otherwise. | 157 // |node|. Returns true if the data was found; and false otherwise. |
164 bool FindFormAndFieldForNode( | 158 bool FindFormAndFieldForNode( |
165 const WebKit::WebNode& node, | 159 const WebKit::WebNode& node, |
166 webkit::forms::FormData* form, | 160 FormData* form, |
167 webkit::forms::FormField* field) WARN_UNUSED_RESULT; | 161 FormFieldData* field) WARN_UNUSED_RESULT; |
168 | 162 |
169 // Set |node| to display the given |value|. | 163 // Set |node| to display the given |value|. |
170 void SetNodeText(const string16& value, WebKit::WebInputElement* node); | 164 void SetNodeText(const string16& value, WebKit::WebInputElement* node); |
171 | 165 |
172 FormCache form_cache_; | 166 FormCache form_cache_; |
173 | 167 |
174 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. | 168 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. |
175 | 169 |
176 // The ID of the last request sent for form field Autofill. Used to ignore | 170 // The ID of the last request sent for form field Autofill. Used to ignore |
177 // out of date responses. | 171 // out of date responses. |
(...skipping 26 matching lines...) Expand all Loading... |
204 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); | 198 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); |
205 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); | 199 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); |
206 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); | 200 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); |
207 | 201 |
208 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 202 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
209 }; | 203 }; |
210 | 204 |
211 } // namespace autofill | 205 } // namespace autofill |
212 | 206 |
213 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 207 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
OLD | NEW |