diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 22:37:38 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 22:37:38 +0000 |
commit | 690f3945e204a932a3ca7bd94517d8b4eb2dd5bd (patch) | |
tree | 7085851f6282e03b7d1d461caecb3e5e78379195 /chrome/browser/autofill | |
parent | 528e778be5a5b00b25e9c08f247315939458e2bc (diff) | |
download | chromium_src-690f3945e204a932a3ca7bd94517d8b4eb2dd5bd.zip chromium_src-690f3945e204a932a3ca7bd94517d8b4eb2dd5bd.tar.gz chromium_src-690f3945e204a932a3ca7bd94517d8b4eb2dd5bd.tar.bz2 |
[views] continue with Autofill interactive dialog
Make progress on local data sunny day: hook up AutofillDialogController to Autofill backend. Also, separate Billing and CC data inputs so they can be selected separately (to match Autofill backend).
BUG=157270, 157273
Review URL: https://codereview.chromium.org/11368158
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r-- | chrome/browser/autofill/DEPS | 1 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 23 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.h | 3 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure.h | 20 |
4 files changed, 33 insertions, 14 deletions
diff --git a/chrome/browser/autofill/DEPS b/chrome/browser/autofill/DEPS index 444be9a..32aaa6c 100644 --- a/chrome/browser/autofill/DEPS +++ b/chrome/browser/autofill/DEPS @@ -6,6 +6,7 @@ include_rules = [ "+chrome/browser/api", "+chrome/browser/autofill", "+chrome/browser/common", + "+chrome/browser/ui/autofill", # Permanently-allowed DEPS beyond the standard Browser # Components-like DEPS above go here. diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index f8888e3..b143d80 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -38,6 +38,7 @@ #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/phone_number.h" #include "chrome/browser/autofill/phone_number_i18n.h" +#include "chrome/browser/ui/autofill/autofill_dialog_controller.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -768,14 +769,28 @@ void AutofillManager::OnSetDataList(const std::vector<string16>& values, } void AutofillManager::OnRequestAutocomplete(const FormData& form) { + base::Callback<void(const FormStructure*)> callback = + base::Bind(&AutofillManager::ReturnAutocompleteData, this); + autofill::AutofillDialogController* controller = + new autofill::AutofillDialogController(web_contents(), + form, + callback); + controller->Show(); +} + +void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { RenderViewHost* host = web_contents()->GetRenderViewHost(); if (!host) return; - // TODO(dbeam): implement interactive autocomplete UI. Just send an error - // right away until we have an implementation. (http://webk.it/100560) - host->Send(new AutofillMsg_RequestAutocompleteFinished( - host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); + if (!result) { + host->Send(new AutofillMsg_RequestAutocompleteFinished( + host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); + } else { + // TODO(estade): implement non-failure case. + host->Send(new AutofillMsg_RequestAutocompleteFinished( + host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); + } } void AutofillManager::OnLoadedServerPredictions( diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 6c332b0..44bf2b8 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -228,6 +228,9 @@ class AutofillManager : public content::WebContentsObserver, // Requests an interactive autocomplete UI be shown. void OnRequestAutocomplete(const FormData& form); + // Passes return data for an OnRequestAutocomplete call back to the page. + void ReturnAutocompleteData(const FormStructure* result); + // Fills |host| with the RenderViewHost for this tab. // Returns false if Autofill is disabled or if the host is unavailable. bool GetHost(content::RenderViewHost** host) const WARN_UNUSED_RESULT; diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h index 92936f0..5f96e6c 100644 --- a/chrome/browser/autofill/form_structure.h +++ b/chrome/browser/autofill/form_structure.h @@ -114,6 +114,16 @@ class FormStructure { const base::TimeTicks& interaction_time, const base::TimeTicks& submission_time) const; + // Classifies each field in |fields_| based upon its |autocomplete| attribute, + // if the attribute is available. The association is stored into the field's + // |heuristic_type|. + // Fills |found_types| with |true| if the attribute is available and neither + // empty nor set to the special values "on" or "off" for at least one field. + // Fills |found_sections| with |true| if the attribute specifies a section for + // at least one field. + void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, + bool* found_sections); + const AutofillField* field(size_t index) const; AutofillField* field(size_t index); size_t field_count() const; @@ -154,16 +164,6 @@ class FormStructure { bool EncodeFormRequest(EncodeRequestType request_type, buzz::XmlElement* encompassing_xml_element) const; - // Classifies each field in |fields_| based upon its |autocomplete| attribute, - // if the attribute is available. The association is stored into the field's - // |heuristic_type|. - // Fills |found_types| with |true| if the attribute is available and neither - // empty nor set to the special values "on" or "off" for at least one field. - // Fills |found_sections| with |true| if the attribute specifies a section for - // at least one field. - void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, - bool* found_sections); - // Classifies each field in |fields_| into a logical section. // Sections are identified by the heuristic that a logical section should not // include multiple fields of the same autofill type (with some exceptions, as |