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