Index: chrome/browser/autofill/autofill_external_delegate.h |
diff --git a/chrome/browser/autofill/autofill_external_delegate.h b/chrome/browser/autofill/autofill_external_delegate.h |
index 7a88c9813fe7b074ce0d182cda22799134111131..2a822b6ebb97fd1166b79111adf06268182ff4ef 100644 |
--- a/chrome/browser/autofill/autofill_external_delegate.h |
+++ b/chrome/browser/autofill/autofill_external_delegate.h |
@@ -9,15 +9,19 @@ |
#include <vector> |
#include "base/string16.h" |
+#include "webkit/glue/form_field.h" |
class AutofillManager; |
class TabContentsWrapper; |
namespace webkit_glue { |
struct FormData; |
-struct FormField; |
} // namespace webkit_glue |
+// TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
+// Once Autofill is moved out of WebKit this class should be the only home for |
+// this logic. |
Ilya Sherman
2011/11/17 02:24:37
nit: Please add a link to http://crbug.com/51644
csharp
2011/11/18 18:15:10
Done.
|
+ |
// Delegate for external processing of Autocomplete and Autofill |
// display and selection. |
class AutofillExternalDelegate { |
@@ -33,17 +37,17 @@ class AutofillExternalDelegate { |
// when the renderer posts an Autofill query to the browser. |
virtual void OnQuery(int query_id, |
const webkit_glue::FormData& form, |
- const webkit_glue::FormField& field) = 0; |
+ const webkit_glue::FormField& field, |
+ bool display_warning); |
Ilya Sherman
2011/11/17 02:24:37
nit: Please describe the role of |display_warning|
csharp
2011/11/18 18:15:10
Done.
|
- // Records query results. Displays them to the user with an external |
- // Autofill popup that lives completely in the browser. Called when |
- // an Autofill query result is available. |
+ // Records query results and correctly formats them before sending them off |
+ // to be displayed. Called when an Autofill query result is available. |
virtual void OnSuggestionsReturned( |
int query_id, |
const std::vector<string16>& autofill_values, |
const std::vector<string16>& autofill_labels, |
const std::vector<string16>& autofill_icons, |
- const std::vector<int>& autofill_unique_ids) = 0; |
+ const std::vector<int>& autofill_unique_ids); |
// Platforms that wish to implement an external Autofill delegate |
// MUST implement this. The 1st arg is the tab contents that owns |
@@ -52,12 +56,51 @@ class AutofillExternalDelegate { |
static AutofillExternalDelegate* Create(TabContentsWrapper*, |
AutofillManager*); |
+ // Inform the delegate that the text field editing has ended, this is |
+ // used to help record the metrics of when a new popup is shown. |
+ void SetDidEndTextFieldEditing(); |
+ |
protected: |
explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper); |
+ // Displays the the Autofill results to the user with an external |
+ // Autofill popup that lives completely in the browser. The suggestions |
+ // have be correctly formatted by this point. |
+ virtual void ApplyAutofillSuggestions( |
+ const std::vector<string16>& autofill_values, |
+ const std::vector<string16>& autofill_labels, |
+ const std::vector<string16>& autofill_icons, |
+ const std::vector<int>& autofill_unique_ids, |
+ int separator_index) = 0; |
+ |
+ // Handle instance specific OnQueryCode. |
+ virtual void OnQueryPlatformSpecific(int query_id, |
+ const webkit_glue::FormData& form, |
+ const webkit_glue::FormField& field) = 0; |
+ |
private: |
TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
+ // The ID of the last request sent for form field Autofill. Used to ignore |
+ // out of date responses. |
+ int autofill_query_id_; |
+ |
+ // The current field selected by Autofill. |
+ webkit_glue::FormField autofill_query_field_; |
+ |
+ // Should we display a warning if autofill is disabled? |
+ bool display_warning_if_disabled_; |
+ |
+ // The menu index of the "Clear" menu item. |
+ int suggestions_clear_index_; |
+ |
+ // The menu index of the "Autofill options..." menu item. |
+ int suggestions_options_index_; |
Ilya Sherman
2011/11/17 02:24:37
I'm not sure that we'll need these indices for the
csharp
2011/11/18 18:15:10
Good point, I've taken them out.
On 2011/11/17 02
|
+ |
+ // Have we already shown Autofill suggestions for the field the user is |
+ // currently editing? Used to keep track of state for metrics logging. |
+ bool has_shown_autofill_popup_for_current_edit_; |
+ |
DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
}; |