diff options
author | Ben Murdoch <benm@google.com> | 2010-07-29 17:14:53 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-04 14:29:45 +0100 |
commit | c407dc5cd9bdc5668497f21b26b09d988ab439de (patch) | |
tree | 7eaf8707c0309516bdb042ad976feedaf72b0bb1 /webkit/glue/password_form_dom_manager.h | |
parent | 0998b1cdac5733f299c12d88bc31ef9c8035b8fa (diff) | |
download | external_chromium-c407dc5cd9bdc5668497f21b26b09d988ab439de.zip external_chromium-c407dc5cd9bdc5668497f21b26b09d988ab439de.tar.gz external_chromium-c407dc5cd9bdc5668497f21b26b09d988ab439de.tar.bz2 |
Merge Chromium src@r53293
Change-Id: Ia79acf8670f385cee48c45b0a75371d8e950af34
Diffstat (limited to 'webkit/glue/password_form_dom_manager.h')
-rw-r--r-- | webkit/glue/password_form_dom_manager.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/webkit/glue/password_form_dom_manager.h b/webkit/glue/password_form_dom_manager.h new file mode 100644 index 0000000..63a6f45 --- /dev/null +++ b/webkit/glue/password_form_dom_manager.h @@ -0,0 +1,63 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_GLUE_PASSWORD_FORM_DOM_MANAGER_H_ +#define WEBKIT_GLUE_PASSWORD_FORM_DOM_MANAGER_H_ + +#include "webkit/glue/form_data.h" +#include "webkit/glue/password_form.h" + +namespace WebKit { +class WebForm; +} + +class GURL; + +namespace webkit_glue { + +// Structure used for autofilling password forms. +// basic_data identifies the HTML form on the page and preferred username/ +// password for login, while +// additional_logins is a list of other matching user/pass pairs for the form. +// wait_for_username tells us whether we need to wait for the user to enter +// a valid username before we autofill the password. By default, this is off +// unless the PasswordManager determined there is an additional risk +// associated with this form. This can happen, for example, if action URI's +// of the observed form and our saved representation don't match up. +struct PasswordFormFillData { + typedef std::map<string16, string16> LoginCollection; + + FormData basic_data; + LoginCollection additional_logins; + bool wait_for_username; + PasswordFormFillData(); + ~PasswordFormFillData(); +}; + +class PasswordFormDomManager { + public: + // Create a PasswordForm from DOM form. Webkit doesn't allow storing + // custom metadata to DOM nodes, so we have to do this every time an event + // happens with a given form and compare against previously Create'd forms + // to identify..which sucks. + static PasswordForm* CreatePasswordForm(const WebKit::WebFormElement& form); + + // Create a FillData structure in preparation for autofilling a form, + // from basic_data identifying which form to fill, and a collection of + // matching stored logins to use as username/password values. + // preferred_match should equal (address) one of matches. + // wait_for_username_before_autofill is true if we should not autofill + // anything until the user typed in a valid username and blurred the field. + static void InitFillData(const PasswordForm& form_on_page, + const PasswordFormMap& matches, + const PasswordForm* const preferred_match, + bool wait_for_username_before_autofill, + PasswordFormFillData* result); + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); +}; + +} // namespace webkit_glue + +#endif // WEBKIT_GLUE_PASSWORD_FORM_DOM_MANAGER_H__ |