1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "components/autofill/core/common/password_form_field_prediction_map.h"
17 class WebInputElement
;
27 // Helper functions to assist in getting the canonical form of the action and
28 // origin. The action will proplerly take into account <BASE>, and both will
29 // strip unnecessary data (e.g. query params and HTTP credentials).
30 GURL
GetCanonicalActionForForm(const blink::WebFormElement
& form
);
31 GURL
GetCanonicalOriginForDocument(const blink::WebDocument
& document
);
33 // Create a PasswordForm from DOM form. Webkit doesn't allow storing
34 // custom metadata to DOM nodes, so we have to do this every time an event
35 // happens with a given form and compare against previously Create'd forms
36 // to identify..which sucks.
37 // If an element of |form| has an entry in |nonscript_modified_values|, the
38 // associated string is used instead of the element's value to create
40 // |form_predictions| is Autofill server response, if present it's used for
41 // overwriting default username element selection.
42 scoped_ptr
<PasswordForm
> CreatePasswordForm(
43 const blink::WebFormElement
& form
,
44 const std::map
<const blink::WebInputElement
, blink::WebString
>*
45 nonscript_modified_values
,
46 const std::map
<autofill::FormData
,
47 autofill::PasswordFormFieldPredictionMap
>* form_predictions
);
49 } // namespace autofill
51 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H__