Commit 9793fb23 authored by dbeam@chromium.org's avatar dbeam@chromium.org

Implement 'invalid' AutocompleteErrorEvent#reason

R=isherman@chromium.org
BUG=168967

Review URL: https://chromiumcodereview.appspot.com/17391012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207791 0039d316-1c4b-4281-b951-d872f2087c98
parent f6113071
......@@ -597,6 +597,10 @@ void AutofillDialogControllerImpl::OnAutocheckoutSuccess() {
view_->UpdateButtonStrip();
}
TestableAutofillDialogView* AutofillDialogControllerImpl::GetTestableView() {
return view_ ? view_->GetTestableView() : NULL;
}
////////////////////////////////////////////////////////////////////////////////
// AutofillDialogController implementation.
......
......@@ -53,6 +53,7 @@ class AutofillDataModel;
class AutofillDialogView;
class AutofillPopupControllerImpl;
class DataModelWrapper;
class TestableAutofillDialogView;
namespace risk {
class Fingerprint;
......@@ -101,6 +102,10 @@ class AutofillDialogControllerImpl : public AutofillDialogController,
// Called when an Autocheckout flow completes successfully.
void OnAutocheckoutSuccess();
// Returns |view_| as a testable version of itself (if |view_| exists and
// actually implements |AutofillDialogView::GetTestableView()|).
TestableAutofillDialogView* GetTestableView();
// AutofillDialogController implementation.
virtual string16 DialogTitle() const OVERRIDE;
virtual string16 AccountChooserText() const OVERRIDE;
......
......@@ -75,6 +75,11 @@ class TabAutofillManagerDelegate
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
// Exposed for testing.
AutofillDialogControllerImpl* GetDialogControllerForTesting() {
return dialog_controller_.get();
}
private:
explicit TabAutofillManagerDelegate(content::WebContents* web_contents);
friend class content::WebContentsUserData<TabAutofillManagerDelegate>;
......
......@@ -26,6 +26,10 @@ class TestableAutofillDialogView {
virtual void SetTextContentsOfInput(const DetailInput& input,
const string16& contents) = 0;
// Sets the content of the extra field for a section.
virtual void SetTextContentsOfSuggestionInput(DialogSection section,
const base::string16& text) = 0;
// Simulates a user activatino of the input which is modelled by |input|.
virtual void ActivateInput(const DetailInput& input) = 0;
......
......@@ -1219,6 +1219,13 @@ void AutofillDialogViews::SetTextContentsOfInput(const DetailInput& input,
NOTREACHED();
}
void AutofillDialogViews::SetTextContentsOfSuggestionInput(
DialogSection section,
const base::string16& text) {
GroupForSection(section)->suggested_info->decorated_textfield()->
SetText(text);
}
void AutofillDialogViews::ActivateInput(const DetailInput& input) {
TextfieldEditedOrActivated(TextfieldForInput(input), false);
}
......
......@@ -103,6 +103,9 @@ class AutofillDialogViews : public AutofillDialogView,
virtual string16 GetTextContentsOfInput(const DetailInput& input) OVERRIDE;
virtual void SetTextContentsOfInput(const DetailInput& input,
const string16& contents) OVERRIDE;
virtual void SetTextContentsOfSuggestionInput(
DialogSection section,
const base::string16& text) OVERRIDE;
virtual void ActivateInput(const DetailInput& input) OVERRIDE;
virtual gfx::Size GetSize() const OVERRIDE;
......
......@@ -744,8 +744,11 @@ void AutofillAgent::OnRequestAutocompleteResult(
if (in_flight_request_form_.isNull())
return;
if (result == WebFormElement::AutocompleteResultSuccess)
if (result == WebFormElement::AutocompleteResultSuccess) {
FillFormIncludingNonFocusableElements(form_data, in_flight_request_form_);
if (!in_flight_request_form_.checkValidityWithoutDispatchingEvents())
result = WebFormElement::AutocompleteResultErrorInvalid;
}
in_flight_request_form_.finishRequestAutocomplete(result);
in_flight_request_form_.reset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment