diff options
author | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 02:38:04 +0000 |
---|---|---|
committer | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 02:38:04 +0000 |
commit | f0961cfdecddaaac9c89fb65c67ba3377d066043 (patch) | |
tree | 61ad1f994b2130b8fbc67555d08319c14fa5793b /webkit/glue/webframeloaderclient_impl.cc | |
parent | d893ab9643e5284db08087bc7514f59e37d6b319 (diff) | |
download | chromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.zip chromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.tar.gz chromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.tar.bz2 |
Review URL: http://codereview.chromium.org/10237
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframeloaderclient_impl.cc')
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 817993b..6c50037 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -42,7 +42,6 @@ MSVC_POP_WARNING(); #if defined(OS_WIN) #include "webkit/activex_shim/activex_shared.h" #endif -#include "webkit/glue/autofill_form.h" #include "webkit/glue/alt_404_page_resource_fetcher.h" #include "webkit/glue/autocomplete_input_listener.h" #include "webkit/glue/form_autocomplete_listener.h" @@ -344,8 +343,7 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { PassRefPtr<WebCore::HTMLCollection> forms = webframe_->frame()->document()->forms(); - std::vector<PasswordForm> passwordForms; - + std::vector<PasswordForm> actions; unsigned int form_count = forms->length(); for (unsigned int i = 0; i < form_count; ++i) { // Strange but true, sometimes item can be NULL. @@ -359,21 +357,18 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { continue; std::set<std::wstring> password_related_fields; - scoped_ptr<PasswordForm> passwordFormPtr( + scoped_ptr<PasswordForm> data( PasswordFormDomManager::CreatePasswordForm(form)); - - if (passwordFormPtr.get()) { - passwordForms.push_back(*passwordFormPtr); - + if (data.get()) { + actions.push_back(*data); // Let's remember the names of password related fields so we do not // autofill them with the regular form autofill. - - if (!passwordFormPtr->username_element.empty()) - password_related_fields.insert(passwordFormPtr->username_element); - DCHECK(!passwordFormPtr->password_element.empty()); - password_related_fields.insert(passwordFormPtr->password_element); - if (!passwordFormPtr->old_password_element.empty()) - password_related_fields.insert(passwordFormPtr->old_password_element); + if (!data->username_element.empty()) + password_related_fields.insert(data->username_element); + DCHECK(!data->password_element.empty()); + password_related_fields.insert(data->password_element); + if (!data->old_password_element.empty()) + password_related_fields.insert(data->old_password_element); } // Now let's register for any text input. @@ -383,8 +378,8 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { } } - if (d && (passwordForms.size() > 0)) - d->OnPasswordFormsSeen(webview, passwordForms); + if (d && (actions.size() > 0)) + d->OnPasswordFormsSeen(webview, actions); if (d) d->DidFinishDocumentLoadForFrame(webview, webframe_); } @@ -1008,7 +1003,7 @@ void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&) } void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, - PassRefPtr<FormState> form_ref) { + PassRefPtr<FormState> form_ref) { SearchableFormData* form_data = SearchableFormData::Create(form_ref->form()); WebDocumentLoaderImpl* loader = static_cast<WebDocumentLoaderImpl*>( webframe_->frame()->loader()->provisionalDocumentLoader()); @@ -1020,19 +1015,6 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, // Don't free the PasswordFormData, the loader will do that. loader->set_password_form_data(pass_data); - WebViewImpl* webview = webframe_->webview_impl(); - WebViewDelegate* d = webview->delegate(); - - // Unless autocomplete=off, record what the user put in it for future - // autofilling. - if (form_ref->form()->autoComplete()) { - scoped_ptr<AutofillForm> autofill_form( - AutofillForm::CreateAutofillForm(form_ref->form())); - if (autofill_form.get()) { - d->OnAutofillFormSubmitted(webview, *autofill_form); - } - } - loader->set_form_submit(true); (webframe_->frame()->loader()->*function)(PolicyUse); |