| 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 COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const WebKit::WebInputElement& element) OVERRIDE; | 98 const WebKit::WebInputElement& element) OVERRIDE; |
| 99 virtual void textFieldDidReceiveKeyDown( | 99 virtual void textFieldDidReceiveKeyDown( |
| 100 const WebKit::WebInputElement& element, | 100 const WebKit::WebInputElement& element, |
| 101 const WebKit::WebKeyboardEvent& event) OVERRIDE; | 101 const WebKit::WebKeyboardEvent& event) OVERRIDE; |
| 102 virtual void didRequestAutocomplete( | 102 virtual void didRequestAutocomplete( |
| 103 WebKit::WebFrame* frame, | 103 WebKit::WebFrame* frame, |
| 104 const WebKit::WebFormElement& form) OVERRIDE; | 104 const WebKit::WebFormElement& form) OVERRIDE; |
| 105 virtual void setIgnoreTextChanges(bool ignore) OVERRIDE; | 105 virtual void setIgnoreTextChanges(bool ignore) OVERRIDE; |
| 106 | 106 |
| 107 void OnSuggestionsReturned(int query_id, | 107 void OnSuggestionsReturned(int query_id, |
| 108 const std::vector<string16>& values, | 108 const std::vector<base::string16>& values, |
| 109 const std::vector<string16>& labels, | 109 const std::vector<base::string16>& labels, |
| 110 const std::vector<string16>& icons, | 110 const std::vector<base::string16>& icons, |
| 111 const std::vector<int>& unique_ids); | 111 const std::vector<int>& unique_ids); |
| 112 void OnFormDataFilled(int query_id, const FormData& form); | 112 void OnFormDataFilled(int query_id, const FormData& form); |
| 113 void OnFieldTypePredictionsAvailable( | 113 void OnFieldTypePredictionsAvailable( |
| 114 const std::vector<FormDataPredictions>& forms); | 114 const std::vector<FormDataPredictions>& forms); |
| 115 | 115 |
| 116 // For external Autofill selection. | 116 // For external Autofill selection. |
| 117 void OnSetAutofillActionFill(); | 117 void OnSetAutofillActionFill(); |
| 118 void OnClearForm(); | 118 void OnClearForm(); |
| 119 void OnSetAutofillActionPreview(); | 119 void OnSetAutofillActionPreview(); |
| 120 void OnClearPreviewedForm(); | 120 void OnClearPreviewedForm(); |
| 121 void OnSetNodeText(const string16& value); | 121 void OnSetNodeText(const base::string16& value); |
| 122 void OnAcceptDataListSuggestion(const string16& value); | 122 void OnAcceptDataListSuggestion(const base::string16& value); |
| 123 void OnAcceptPasswordAutofillSuggestion(const string16& value); | 123 void OnAcceptPasswordAutofillSuggestion(const base::string16& value); |
| 124 void OnGetAllForms(); | 124 void OnGetAllForms(); |
| 125 | 125 |
| 126 // Called when interactive autocomplete finishes. | 126 // Called when interactive autocomplete finishes. |
| 127 void OnRequestAutocompleteResult( | 127 void OnRequestAutocompleteResult( |
| 128 WebKit::WebFormElement::AutocompleteResult result, | 128 WebKit::WebFormElement::AutocompleteResult result, |
| 129 const FormData& form_data); | 129 const FormData& form_data); |
| 130 | 130 |
| 131 // Called when an autocomplete request succeeds or fails with the |result|. | 131 // Called when an autocomplete request succeeds or fails with the |result|. |
| 132 void FinishAutocompleteRequest( | 132 void FinishAutocompleteRequest( |
| 133 WebKit::WebFormElement::AutocompleteResult result); | 133 WebKit::WebFormElement::AutocompleteResult result); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 bool display_warning_if_disabled); | 166 bool display_warning_if_disabled); |
| 167 | 167 |
| 168 // Queries the browser for Autocomplete and Autofill suggestions for the given | 168 // Queries the browser for Autocomplete and Autofill suggestions for the given |
| 169 // |element|. | 169 // |element|. |
| 170 void QueryAutofillSuggestions(const WebKit::WebInputElement& element, | 170 void QueryAutofillSuggestions(const WebKit::WebInputElement& element, |
| 171 bool display_warning_if_disabled); | 171 bool display_warning_if_disabled); |
| 172 | 172 |
| 173 // Combines DataList suggestion entries with the autofill ones and show them | 173 // Combines DataList suggestion entries with the autofill ones and show them |
| 174 // to the user. | 174 // to the user. |
| 175 void CombineDataListEntriesAndShow(const WebKit::WebInputElement& element, | 175 void CombineDataListEntriesAndShow(const WebKit::WebInputElement& element, |
| 176 const std::vector<string16>& values, | 176 const std::vector<base::string16>& values, |
| 177 const std::vector<string16>& labels, | 177 const std::vector<base::string16>& labels, |
| 178 const std::vector<string16>& icons, | 178 const std::vector<base::string16>& icons, |
| 179 const std::vector<int>& item_ids, | 179 const std::vector<int>& item_ids, |
| 180 bool has_autofill_item); | 180 bool has_autofill_item); |
| 181 | 181 |
| 182 // Sets the element value to reflect the selected |suggested_value|. | 182 // Sets the element value to reflect the selected |suggested_value|. |
| 183 void AcceptDataListSuggestion(const string16& suggested_value); | 183 void AcceptDataListSuggestion(const base::string16& suggested_value); |
| 184 | 184 |
| 185 // Queries the AutofillManager for form data for the form containing |node|. | 185 // Queries the AutofillManager for form data for the form containing |node|. |
| 186 // |value| is the current text in the field, and |unique_id| is the selected | 186 // |value| is the current text in the field, and |unique_id| is the selected |
| 187 // profile's unique ID. |action| specifies whether to Fill or Preview the | 187 // profile's unique ID. |action| specifies whether to Fill or Preview the |
| 188 // values returned from the AutofillManager. | 188 // values returned from the AutofillManager. |
| 189 void FillAutofillFormData(const WebKit::WebNode& node, | 189 void FillAutofillFormData(const WebKit::WebNode& node, |
| 190 int unique_id, | 190 int unique_id, |
| 191 AutofillAction action); | 191 AutofillAction action); |
| 192 | 192 |
| 193 // Fills |form| and |field| with the FormData and FormField corresponding to | 193 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 194 // |node|. Returns true if the data was found; and false otherwise. | 194 // |node|. Returns true if the data was found; and false otherwise. |
| 195 bool FindFormAndFieldForNode( | 195 bool FindFormAndFieldForNode( |
| 196 const WebKit::WebNode& node, | 196 const WebKit::WebNode& node, |
| 197 FormData* form, | 197 FormData* form, |
| 198 FormFieldData* field) WARN_UNUSED_RESULT; | 198 FormFieldData* field) WARN_UNUSED_RESULT; |
| 199 | 199 |
| 200 // Set |node| to display the given |value|. | 200 // Set |node| to display the given |value|. |
| 201 void SetNodeText(const string16& value, WebKit::WebInputElement* node); | 201 void SetNodeText(const base::string16& value, WebKit::WebInputElement* node); |
| 202 | 202 |
| 203 // Hides any currently showing Autofill UI in the renderer or browser. | 203 // Hides any currently showing Autofill UI in the renderer or browser. |
| 204 void HideAutofillUi(); | 204 void HideAutofillUi(); |
| 205 | 205 |
| 206 // Hides any currently showing Autofill UI in the browser only. | 206 // Hides any currently showing Autofill UI in the browser only. |
| 207 void HideHostAutofillUi(); | 207 void HideHostAutofillUi(); |
| 208 | 208 |
| 209 FormCache form_cache_; | 209 FormCache form_cache_; |
| 210 | 210 |
| 211 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. | 211 PasswordAutofillAgent* password_autofill_agent_; // WEAK reference. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); | 273 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername); |
| 274 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); | 274 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept); |
| 275 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); | 275 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect); |
| 276 | 276 |
| 277 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 277 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 } // namespace autofill | 280 } // namespace autofill |
| 281 | 281 |
| 282 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ | 282 #endif // COMPONENTS_AUTOFILL_RENDERER_AUTOFILL_AGENT_H_ |
| OLD | NEW |