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 16 matching lines...) Expand all Loading... | |
| 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 virtual ~AutofillExternalDelegate(); | 33 virtual ~AutofillExternalDelegate(); |
| 34 | 34 |
| 35 // When using an external Autofill delegate. Allows Chrome to tell | 35 // When using an external Autofill delegate. Allows Chrome to tell |
| 36 // WebKit which Autofill selection has been chosen. | 36 // WebKit which Autofill selection has been chosen. |
| 37 // TODO(jrg): add feedback mechanism for hover on relevant platforms. | 37 // TODO(jrg): add feedback mechanism for hover on relevant platforms. |
|
Ilya Sherman
2012/04/20 21:30:48
nit: Is this TODO still relevant, or has this been
csharp
2012/04/24 14:18:48
This has been addressed for Linux, so I'll remove
| |
| 38 virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index); | 38 virtual void SelectAutofillSuggestionAtIndex(int unique_id); |
| 39 | 39 |
| 40 // Records and associates a query_id with web form data. Called | 40 // Records and associates a query_id with web form data. Called |
| 41 // when the renderer posts an Autofill query to the browser. |bounds| | 41 // when the renderer posts an Autofill query to the browser. |bounds| |
| 42 // is window relative. |display_warning_if_disabled| tells us if we should | 42 // is window relative. |display_warning_if_disabled| tells us if we should |
| 43 // display warnings (such as autofill is disabled, but had suggestions). | 43 // display warnings (such as autofill is disabled, but had suggestions). |
| 44 // We might not want to display the warning if a website has disabled | 44 // We might not want to display the warning if a website has disabled |
| 45 // Autocomplete because they have their own popup, and showing our popup | 45 // Autocomplete because they have their own popup, and showing our popup |
| 46 // on to of theirs would be a poor user experience. | 46 // on to of theirs would be a poor user experience. |
| 47 virtual void OnQuery(int query_id, | 47 virtual void OnQuery(int query_id, |
| 48 const webkit::forms::FormData& form, | 48 const webkit::forms::FormData& form, |
| 49 const webkit::forms::FormField& field, | 49 const webkit::forms::FormField& field, |
| 50 const gfx::Rect& bounds, | 50 const gfx::Rect& bounds, |
| 51 bool display_warning_if_disabled); | 51 bool display_warning_if_disabled); |
| 52 | 52 |
| 53 // Records query results and correctly formats them before sending them off | 53 // Records query results and correctly formats them before sending them off |
| 54 // to be displayed. Called when an Autofill query result is available. | 54 // to be displayed. Called when an Autofill query result is available. |
| 55 virtual void OnSuggestionsReturned( | 55 virtual void OnSuggestionsReturned( |
| 56 int query_id, | 56 int query_id, |
| 57 const std::vector<string16>& autofill_values, | 57 const std::vector<string16>& autofill_values, |
| 58 const std::vector<string16>& autofill_labels, | 58 const std::vector<string16>& autofill_labels, |
| 59 const std::vector<string16>& autofill_icons, | 59 const std::vector<string16>& autofill_icons, |
| 60 const std::vector<int>& autofill_unique_ids); | 60 const std::vector<int>& autofill_unique_ids); |
| 61 | 61 |
| 62 // Show password suggestions in the popup. | 62 // Show password suggestions in the popup. |
| 63 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, | 63 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, |
| 64 const webkit::forms::FormField& field, | 64 const webkit::forms::FormField& field, |
| 65 const gfx::Rect& bounds); | 65 const gfx::Rect& bounds); |
| 66 | 66 |
| 67 // Remove the given Autocomplete entry from the DB. | |
| 68 void RemoveAutocompleteEntry(const string16& value); | |
| 69 | |
| 70 // Remove the given Autofill profile or credit credit. | |
| 71 void RemoveAutofillProfileOrCreditCard(int unique_id); | |
| 72 | |
| 67 // Inform the delegate that the text field editing has ended, this is | 73 // 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. | 74 // used to help record the metrics of when a new popup is shown. |
| 69 void DidEndTextFieldEditing(); | 75 void DidEndTextFieldEditing(); |
| 70 | 76 |
| 71 // Inform the delegate that an autofill suggestion have been chosen. Returns | 77 // Inform the delegate that an autofill suggestion have been chosen. Returns |
| 72 // true if the suggestion was selected. | 78 // true if the suggestion was selected. |
| 73 bool DidAcceptAutofillSuggestions(const string16& value, | 79 bool DidAcceptAutofillSuggestions(const string16& value, |
| 74 int unique_id, | 80 int unique_id, |
| 75 unsigned index); | 81 unsigned index); |
| 76 | 82 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 webkit::forms::FormData autofill_query_form_; | 148 webkit::forms::FormData autofill_query_form_; |
| 143 webkit::forms::FormField autofill_query_field_; | 149 webkit::forms::FormField autofill_query_field_; |
| 144 | 150 |
| 145 // Should we display a warning if Autofill is disabled? | 151 // Should we display a warning if Autofill is disabled? |
| 146 bool display_warning_if_disabled_; | 152 bool display_warning_if_disabled_; |
| 147 | 153 |
| 148 // Have we already shown Autofill suggestions for the field the user is | 154 // Have we already shown Autofill suggestions for the field the user is |
| 149 // currently editing? Used to keep track of state for metrics logging. | 155 // currently editing? Used to keep track of state for metrics logging. |
| 150 bool has_shown_autofill_popup_for_current_edit_; | 156 bool has_shown_autofill_popup_for_current_edit_; |
| 151 | 157 |
| 152 // The menu index of the "Clear" menu item. | |
| 153 int suggestions_clear_index_; | |
| 154 | |
| 155 // The menu index of the "Autofill options..." menu item. | |
| 156 int suggestions_options_index_; | |
| 157 | |
| 158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 161 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |