Index: chrome/browser/ui/autofill/autofill_dialog_controller.h |
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller.h b/chrome/browser/ui/autofill/autofill_dialog_controller.h |
index 0a4a581b1110c6e00d163e62987791fc162d53e4..d0b71532debdb73a686a375f0ddf01eee6e626f7 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_controller.h |
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller.h |
@@ -15,10 +15,15 @@ |
#include "base/string16.h" |
#include "chrome/browser/autofill/field_types.h" |
#include "chrome/browser/autofill/form_structure.h" |
+#include "chrome/browser/autofill/personal_data_manager.h" |
#include "chrome/browser/ui/autofill/autofill_dialog_comboboxes.h" |
+#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
+#include "chrome/browser/ui/autofill/autofill_popup_delegate.h" |
#include "content/public/common/ssl_status.h" |
#include "ui/base/models/combobox_model.h" |
+#include "ui/gfx/native_widget_types.h" |
+class AutofillPopupControllerImpl; |
class FormGroup; |
class GURL; |
class Profile; |
@@ -27,6 +32,10 @@ namespace content { |
class WebContents; |
} |
+namespace gfx { |
+class Rect; |
+} |
+ |
namespace autofill { |
class AutofillDialogView; |
@@ -48,7 +57,7 @@ struct DetailInput { |
float expand_weight; |
// When non-empty, indicates the value that should be pre-filled into the |
// input. |
- string16 starting_value; |
+ string16 autofilled_value; |
}; |
// Sections of the dialog --- all fields that may be shown to the user fit under |
@@ -71,7 +80,7 @@ typedef std::map<const DetailInput*, string16> DetailOutputMap; |
// This class drives the dialog that appears when a site uses the imperative |
// autocomplete API to fill out a form. |
-class AutofillDialogController { |
+class AutofillDialogController : public AutofillPopupDelegate { |
public: |
AutofillDialogController( |
content::WebContents* contents, |
@@ -108,6 +117,24 @@ class AutofillDialogController { |
// whether the Autofill operation should be aborted. |
void ViewClosed(DialogAction action); |
+ // Called by the view when the user changes the contents of a text field. |
+ void UserEditedInput(const DetailInput* input, |
+ gfx::NativeView view, |
+ const gfx::Rect& content_bounds, |
+ const string16& field_contents); |
+ |
+ // Called when focus has changed position within the view. |
+ void FocusMoved(); |
+ |
+ // AutofillPopupDelegate implementation. |
+ virtual void DidSelectSuggestion(int identifier) OVERRIDE; |
+ virtual void DidAcceptSuggestion(const string16& value, |
+ int identifier) OVERRIDE; |
+ virtual void RemoveSuggestion(int identifier) OVERRIDE; |
+ virtual void RemoveAutocompleteEntry(const string16& value) OVERRIDE; |
+ virtual void ClearPreviewedForm() OVERRIDE; |
+ virtual void ControllerDestroyed() OVERRIDE; |
+ |
content::WebContents* web_contents() { return contents_; } |
private: |
@@ -124,11 +151,6 @@ class AutofillDialogController { |
// Initializes |suggested_email_| et al. |
void GenerateComboboxModels(); |
- // Fills in all the DetailInputs structs with guessed values for |
- // starting_value. The guesses come from Autofill data, drawing from the most |
- // filled out AutofillProfile. |
- void PopulateInputsWithGuesses(); |
- |
// Fills in |section|-related fields in |output_| according to the state of |
// |view_|. |
void FillOutputForSection(DialogSection section); |
@@ -146,6 +168,21 @@ class AutofillDialogController { |
// Gets the SuggestionsComboboxModel for |section|. |
SuggestionsComboboxModel* SuggestionsModelForSection(DialogSection section); |
+ // Loads profiles that can suggest data for |type|. |field_contents| is the |
+ // part the user has already typed. |inputs| is the rest of section. |
+ // Identifying info is loaded into the last three outparams as well as |
+ // |popup_guids_|. |
+ void GetProfileSuggestions( |
+ AutofillFieldType type, |
+ const string16& field_contents, |
+ const DetailInputs& inputs, |
+ std::vector<string16>* popup_values, |
+ std::vector<string16>* popup_labels, |
+ std::vector<string16>* popup_icons); |
+ |
+ // Returns the PersonalDataManager for |profile_|. |
+ PersonalDataManager* GetManager(); |
+ |
// The |profile| for |contents_|. |
Profile* const profile_; |
@@ -178,6 +215,11 @@ class AutofillDialogController { |
SuggestionsComboboxModel suggested_billing_; |
SuggestionsComboboxModel suggested_shipping_; |
+ // The GUIDs for the currently showing unverified profiles popup. |
+ std::vector<PersonalDataManager::GUIDPair> popup_guids_; |
+ |
+ AutofillPopupControllerImpl* popup_controller_; |
+ |
scoped_ptr<AutofillDialogView> view_; |
DISALLOW_COPY_AND_ASSIGN(AutofillDialogController); |