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_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 } | 23 } |
| 24 | 24 |
| 25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
| 26 // Once Autofill is moved out of WebKit this class should be the only home for | 26 // Once Autofill is moved out of WebKit this class should be the only home for |
| 27 // this logic. See http://crbug.com/51644 | 27 // this logic. See http://crbug.com/51644 |
| 28 | 28 |
| 29 // Delegate for external processing of Autocomplete and Autofill | 29 // Delegate for external processing of Autocomplete and Autofill |
| 30 // display and selection. | 30 // display and selection. |
| 31 class AutofillExternalDelegate { | 31 class AutofillExternalDelegate { |
| 32 public: | 32 public: |
| 33 // The value to give as the unique id for all warnings. | |
| 34 static const int kWarningId = -1; | |
|
Ilya Sherman
2012/04/18 18:12:51
nit: Let's use the new constants added in the WebK
csharp
2012/04/19 15:33:24
Done.
| |
| 35 | |
| 33 virtual ~AutofillExternalDelegate(); | 36 virtual ~AutofillExternalDelegate(); |
| 34 | 37 |
| 35 // When using an external Autofill delegate. Allows Chrome to tell | 38 // When using an external Autofill delegate. Allows Chrome to tell |
| 36 // WebKit which Autofill selection has been chosen. | 39 // WebKit which Autofill selection has been chosen. |
| 37 // TODO(jrg): add feedback mechanism for hover on relevant platforms. | 40 // TODO(jrg): add feedback mechanism for hover on relevant platforms. |
| 38 virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index); | 41 virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index); |
| 39 | 42 |
| 40 // Records and associates a query_id with web form data. Called | 43 // Records and associates a query_id with web form data. Called |
| 41 // when the renderer posts an Autofill query to the browser. |bounds| | 44 // when the renderer posts an Autofill query to the browser. |bounds| |
| 42 // is window relative. |display_warning_if_disabled| tells us if we should | 45 // is window relative. |display_warning_if_disabled| tells us if we should |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 57 const std::vector<string16>& autofill_values, | 60 const std::vector<string16>& autofill_values, |
| 58 const std::vector<string16>& autofill_labels, | 61 const std::vector<string16>& autofill_labels, |
| 59 const std::vector<string16>& autofill_icons, | 62 const std::vector<string16>& autofill_icons, |
| 60 const std::vector<int>& autofill_unique_ids); | 63 const std::vector<int>& autofill_unique_ids); |
| 61 | 64 |
| 62 // Show password suggestions in the popup. | 65 // Show password suggestions in the popup. |
| 63 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, | 66 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, |
| 64 const webkit::forms::FormField& field, | 67 const webkit::forms::FormField& field, |
| 65 const gfx::Rect& bounds); | 68 const gfx::Rect& bounds); |
| 66 | 69 |
| 70 // Remove the given Autocomplete entry from the DB. | |
| 71 void RemoveAutocompleteEntry(const string16& value); | |
| 72 | |
| 73 // Remove the given Autofill profile or credit credit. | |
| 74 void RemoveAutofillProfileOrCreditCard(int unique_id); | |
| 75 | |
| 67 // Inform the delegate that the text field editing has ended, this is | 76 // Inform the delegate that the text field editing has ended, this is |
| 68 // used to help record the metrics of when a new popup is shown. | 77 // used to help record the metrics of when a new popup is shown. |
| 69 void DidEndTextFieldEditing(); | 78 void DidEndTextFieldEditing(); |
| 70 | 79 |
| 71 // Inform the delegate that an autofill suggestion have been chosen. Returns | 80 // Inform the delegate that an autofill suggestion have been chosen. Returns |
| 72 // true if the suggestion was selected. | 81 // true if the suggestion was selected. |
| 73 bool DidAcceptAutofillSuggestions(const string16& value, | 82 bool DidAcceptAutofillSuggestions(const string16& value, |
| 74 int unique_id, | 83 int unique_id, |
| 75 unsigned index); | 84 unsigned index); |
| 76 | 85 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 // Set the bounds of the Autofill element being worked with. | 130 // Set the bounds of the Autofill element being worked with. |
| 122 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 131 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
| 123 | 132 |
| 124 private: | 133 private: |
| 125 // Fills the form with the Autofill data corresponding to |unique_id|. | 134 // Fills the form with the Autofill data corresponding to |unique_id|. |
| 126 // If |is_preview| is true then this is just a preview to show the user what | 135 // If |is_preview| is true then this is just a preview to show the user what |
| 127 // would be selected and if |is_preview| is false then the user has selected | 136 // would be selected and if |is_preview| is false then the user has selected |
| 128 // this data. | 137 // this data. |
| 129 void FillAutofillFormData(int unique_id, bool is_preview); | 138 void FillAutofillFormData(int unique_id, bool is_preview); |
| 130 | 139 |
| 140 // Adjust the positions of the Non-Autofill menu items. | |
| 141 void AdjustIndicesAfterDeletion(); | |
| 142 | |
| 131 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. | 143 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
| 132 AutofillManager* autofill_manager_; // weak. | 144 AutofillManager* autofill_manager_; // weak. |
| 133 | 145 |
| 134 // Password Autofill manager, handles all password-related Autofilling. | 146 // Password Autofill manager, handles all password-related Autofilling. |
| 135 PasswordAutofillManager password_autofill_manager_; | 147 PasswordAutofillManager password_autofill_manager_; |
| 136 | 148 |
| 137 // The ID of the last request sent for form field Autofill. Used to ignore | 149 // The ID of the last request sent for form field Autofill. Used to ignore |
| 138 // out of date responses. | 150 // out of date responses. |
| 139 int autofill_query_id_; | 151 int autofill_query_id_; |
| 140 | 152 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 152 // The menu index of the "Clear" menu item. | 164 // The menu index of the "Clear" menu item. |
| 153 int suggestions_clear_index_; | 165 int suggestions_clear_index_; |
| 154 | 166 |
| 155 // The menu index of the "Autofill options..." menu item. | 167 // The menu index of the "Autofill options..." menu item. |
| 156 int suggestions_options_index_; | 168 int suggestions_options_index_; |
| 157 | 169 |
| 158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 170 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 159 }; | 171 }; |
| 160 | 172 |
| 161 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 173 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |