Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 // PageClickListener: | 69 // PageClickListener: |
| 70 virtual bool InputElementClicked(const WebKit::WebInputElement& element, | 70 virtual bool InputElementClicked(const WebKit::WebInputElement& element, |
| 71 bool was_focused, | 71 bool was_focused, |
| 72 bool is_focused) OVERRIDE; | 72 bool is_focused) OVERRIDE; |
| 73 virtual bool InputElementLostFocus() OVERRIDE; | 73 virtual bool InputElementLostFocus() OVERRIDE; |
| 74 | 74 |
| 75 // WebKit::WebAutofillClient: | 75 // WebKit::WebAutofillClient: |
| 76 virtual void didAcceptAutofillSuggestion(const WebKit::WebNode& node, | 76 virtual void didAcceptAutofillSuggestion(const WebKit::WebNode& node, |
| 77 const WebKit::WebString& value, | 77 const WebKit::WebString& value, |
| 78 const WebKit::WebString& label, | 78 const WebKit::WebString& label, |
| 79 int unique_id, | 79 int item_id, |
| 80 unsigned index) OVERRIDE; | 80 unsigned index) OVERRIDE; |
| 81 virtual void didSelectAutofillSuggestion(const WebKit::WebNode& node, | 81 virtual void didSelectAutofillSuggestion(const WebKit::WebNode& node, |
| 82 const WebKit::WebString& value, | 82 const WebKit::WebString& value, |
| 83 const WebKit::WebString& label, | 83 const WebKit::WebString& label, |
| 84 int unique_id) OVERRIDE; | 84 int item_id) OVERRIDE; |
| 85 virtual void didClearAutofillSelection(const WebKit::WebNode& node) OVERRIDE; | 85 virtual void didClearAutofillSelection(const WebKit::WebNode& node) OVERRIDE; |
| 86 virtual void removeAutocompleteSuggestion( | 86 virtual void removeAutocompleteSuggestion( |
| 87 const WebKit::WebString& name, | 87 const WebKit::WebString& name, |
| 88 const WebKit::WebString& value) OVERRIDE; | 88 const WebKit::WebString& value) OVERRIDE; |
| 89 virtual void textFieldDidEndEditing( | 89 virtual void textFieldDidEndEditing( |
| 90 const WebKit::WebInputElement& element) OVERRIDE; | 90 const WebKit::WebInputElement& element) OVERRIDE; |
| 91 virtual void textFieldDidChange( | 91 virtual void textFieldDidChange( |
| 92 const WebKit::WebInputElement& element) OVERRIDE; | 92 const WebKit::WebInputElement& element) OVERRIDE; |
| 93 virtual void textFieldDidReceiveKeyDown( | 93 virtual void textFieldDidReceiveKeyDown( |
| 94 const WebKit::WebInputElement& element, | 94 const WebKit::WebInputElement& element, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 void ShowSuggestions(const WebKit::WebInputElement& element, | 130 void ShowSuggestions(const WebKit::WebInputElement& element, |
| 131 bool autofill_on_empty_values, | 131 bool autofill_on_empty_values, |
| 132 bool requires_caret_at_end, | 132 bool requires_caret_at_end, |
| 133 bool display_warning_if_disabled); | 133 bool display_warning_if_disabled); |
| 134 | 134 |
| 135 // Queries the browser for Autocomplete and Autofill suggestions for the given | 135 // Queries the browser for Autocomplete and Autofill suggestions for the given |
| 136 // |element|. | 136 // |element|. |
| 137 void QueryAutofillSuggestions(const WebKit::WebInputElement& element, | 137 void QueryAutofillSuggestions(const WebKit::WebInputElement& element, |
| 138 bool display_warning_if_disabled); | 138 bool display_warning_if_disabled); |
| 139 | 139 |
| 140 void CombineDataListEntriesAndShow(const WebKit::WebInputElement& element, | |
| 141 const std::vector<string16>& values, | |
| 142 const std::vector<string16>& labels, | |
| 143 const std::vector<string16>& icons, | |
| 144 const std::vector<int>& item_ids); | |
|
Ilya Sherman
2012/04/11 19:09:58
nit: Align with the opening paren
keishi
2012/04/12 14:07:11
Done.
| |
| 145 | |
| 140 // Queries the AutofillManager for form data for the form containing |node|. | 146 // Queries the AutofillManager for form data for the form containing |node|. |
| 141 // |value| is the current text in the field, and |unique_id| is the selected | 147 // |value| is the current text in the field, and |item_id| is the selected |
|
Ilya Sherman
2012/04/11 19:09:58
nit: unique_id
keishi
2012/04/12 14:07:11
Done.
| |
| 142 // profile's unique ID. |action| specifies whether to Fill or Preview the | 148 // profile's unique ID. |action| specifies whether to Fill or Preview the |
| 143 // values returned from the AutofillManager. | 149 // values returned from the AutofillManager. |
| 144 void FillAutofillFormData(const WebKit::WebNode& node, | 150 void FillAutofillFormData(const WebKit::WebNode& node, |
| 145 int unique_id, | 151 int unique_id, |
| 146 AutofillAction action); | 152 AutofillAction action); |
| 147 | 153 |
| 148 // Fills |form| and |field| with the FormData and FormField corresponding to | 154 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 149 // |node|. Returns true if the data was found; and false otherwise. | 155 // |node|. Returns true if the data was found; and false otherwise. |
| 150 bool FindFormAndFieldForNode( | 156 bool FindFormAndFieldForNode( |
| 151 const WebKit::WebNode& node, | 157 const WebKit::WebNode& node, |
| 152 webkit::forms::FormData* form, | 158 webkit::forms::FormData* form, |
| 153 webkit::forms::FormField* field) WARN_UNUSED_RESULT; | 159 webkit::forms::FormField* field) WARN_UNUSED_RESULT; |
| 154 | 160 |
| 155 // Set |node| to display the given |value|. | 161 // Set |node| to display the given |value|. |
| 156 void SetNodeText(const string16& value, WebKit::WebInputElement* node); | 162 void SetNodeText(const string16& value, WebKit::WebInputElement* node); |
| 157 | 163 |
| 158 FormCache form_cache_; | 164 FormCache form_cache_; |
| 159 | 165 |
| 160 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. | 166 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. |
| 161 | 167 |
| 162 // The ID of the last request sent for form field Autofill. Used to ignore | 168 // The ID of the last request sent for form field Autofill. Used to ignore |
| 163 // out of date responses. | 169 // out of date responses. |
| 164 int autofill_query_id_; | 170 int autofill_query_id_; |
| 165 | 171 |
| 166 // The element corresponding to the last request sent for form field Autofill. | 172 // The element corresponding to the last request sent for form field Autofill. |
| 167 WebKit::WebInputElement autofill_query_element_; | 173 WebKit::WebInputElement element_; |
| 168 | 174 |
| 169 // The action to take when receiving Autofill data from the AutofillManager. | 175 // The action to take when receiving Autofill data from the AutofillManager. |
| 170 AutofillAction autofill_action_; | 176 AutofillAction autofill_action_; |
| 171 | 177 |
| 172 // Should we display a warning if autofill is disabled? | 178 // Should we display a warning if autofill is disabled? |
| 173 bool display_warning_if_disabled_; | 179 bool display_warning_if_disabled_; |
| 174 | 180 |
| 175 // Was the query node autofilled prior to previewing the form? | 181 // Was the query node autofilled prior to previewing the form? |
| 176 bool was_query_node_autofilled_; | 182 bool was_query_node_autofilled_; |
| 177 | 183 |
| 178 // The menu index of the "Clear" menu item. | |
| 179 int suggestions_clear_index_; | |
| 180 | |
| 181 // The menu index of the "Autofill options..." menu item. | |
| 182 int suggestions_options_index_; | |
| 183 | |
| 184 // Have we already shown Autofill suggestions for the field the user is | 184 // Have we already shown Autofill suggestions for the field the user is |
| 185 // currently editing? Used to keep track of state for metrics logging. | 185 // currently editing? Used to keep track of state for metrics logging. |
| 186 bool has_shown_autofill_popup_for_current_edit_; | 186 bool has_shown_autofill_popup_for_current_edit_; |
| 187 | 187 |
| 188 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; | 188 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; |
| 189 | 189 |
| 190 friend class PasswordAutofillManagerTest; | 190 friend class PasswordAutofillManagerTest; |
| 191 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms); | 191 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, SendForms); |
| 192 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement); | 192 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, FillFormElement); |
| 193 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); | 193 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); |
| 194 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); | 194 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); |
| 195 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); | 195 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); |
| 196 | 196 |
| 197 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 197 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace autofill | 200 } // namespace autofill |
| 201 | 201 |
| 202 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 202 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| OLD | NEW |