Chromium Code Reviews| 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 20d15bb6fc82400d891c92fe9049b5113df89896..3d4772c2aadf38db08d4777c273bf8ff1ed99d47 100644 |
| --- a/chrome/browser/autofill/autofill_external_delegate.h |
| +++ b/chrome/browser/autofill/autofill_external_delegate.h |
| @@ -8,7 +8,9 @@ |
| #include <vector> |
| +#include "base/compiler_specific.h" |
| #include "base/string16.h" |
| +#include "webkit/forms/form_data.h" |
| #include "webkit/forms/form_field.h" |
| class AutofillManager; |
| @@ -18,12 +20,6 @@ namespace gfx { |
| class Rect; |
| } |
| -namespace webkit { |
| -namespace forms { |
| -struct FormData; |
| -} |
| -} |
| - |
| // 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. See http://crbug.com/51644 |
| @@ -37,7 +33,7 @@ class AutofillExternalDelegate { |
| // When using an external Autofill delegate. Allows Chrome to tell |
| // WebKit which Autofill selection has been chosen. |
| // TODO(jrg): add feedback mechanism for hover on relevant platforms. |
| - void SelectAutofillSuggestionAtIndex(int listIndex); |
| + virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index); |
| // Records and associates a query_id with web form data. Called |
| // when the renderer posts an Autofill query to the browser. |bounds| |
| @@ -61,8 +57,20 @@ class AutofillExternalDelegate { |
| const std::vector<string16>& autofill_icons, |
| const std::vector<int>& autofill_unique_ids); |
| + // 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 DidEndTextFieldEditing(); |
| + |
| + // Inform the delegate that an autofill suggestion have been chosen. |
| + void didAcceptAutofillSuggestions( |
|
Ilya Sherman
2012/02/04 04:10:52
nit: "didAccept..." -> "DidAccept"
csharp
2012/02/07 22:30:58
Done.
|
| + string16 value,int unique_id, unsigned index); |
|
Ilya Sherman
2012/02/04 04:10:52
nit: Since this is a header file, the parameters s
csharp
2012/02/07 22:30:58
Done.
|
| + |
| + // Informs the delegate that the Autofill selection has been cleared |
| + // (i.e. there is now Autofill selection now). |
|
Ilya Sherman
2012/02/04 04:10:52
nit: "there is now" -> "there is no"
csharp
2012/02/07 22:30:58
Done.
|
| + virtual void ClearAutofillSelection(); |
| + |
| // Hide the Autofill poup. |
| - virtual void HideAutofillPopup() = 0; |
| + void HideAutofillPopup(); |
| // Platforms that wish to implement an external Autofill delegate |
| // MUST implement this. The 1st arg is the tab contents that owns |
| @@ -70,11 +78,6 @@ class AutofillExternalDelegate { |
| // tab contents. |
| 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 DidEndTextFieldEditing(); |
| - |
| protected: |
| explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper, |
| AutofillManager* autofill_manager); |
| @@ -95,7 +98,15 @@ class AutofillExternalDelegate { |
| const webkit::forms::FormField& field, |
| const gfx::Rect& bounds) = 0; |
| + // Handle platform-dependent hiding. |
| + void virtual HideAutofillPopupInternal() = 0; |
|
Ilya Sherman
2012/02/04 04:10:52
nit: "void virtual" -> "virtual void"
csharp
2012/02/07 22:30:58
Done.
|
| + |
| private: |
| + // Sends the Autofill data to Autofill manager as well as telling the renderer |
| + // if the form is a preview. If |is_preview| is true we are just showing a |
|
Ilya Sherman
2012/02/04 04:10:52
nit: I find this first sentence a bit hard to make
csharp
2012/02/07 22:30:58
Done.
|
| + // preview of the form, otherwise we are filling it. |
| + void FillAutofillFormData(int unique_id, bool is_preview); |
| + |
| TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
| AutofillManager* autofill_manager_; // weak. |
| @@ -103,7 +114,8 @@ class AutofillExternalDelegate { |
| // out of date responses. |
| int autofill_query_id_; |
| - // The current field selected by Autofill. |
| + // The current form and field selected by Autofill. |
| + webkit::forms::FormData autofill_query_form_; |
| webkit::forms::FormField autofill_query_field_; |
| // Should we display a warning if Autofill is disabled? |
| @@ -113,6 +125,12 @@ class AutofillExternalDelegate { |
| // currently editing? Used to keep track of state for metrics logging. |
| bool has_shown_autofill_popup_for_current_edit_; |
| + // 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_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| }; |